api 5045포트 연결

This commit is contained in:
DESKTOP-F6681KC\llk
2024-06-02 20:48:47 +09:00
parent 1be2f7c5a7
commit 9dfe0b6d30
3 changed files with 33 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Bitget_Server.Controller
{
[ApiController, Route("api/push")]
[ApiController, Route("api")]
public class PushAlarmController : ControllerBase
{
private readonly BitgetContext context;
@@ -15,10 +15,30 @@ namespace Bitget_Server.Controller
context = _context;
}
[HttpGet, Route("newalarm")]
[HttpGet, Route("getalarm")]
public List<PushAlarm> GetAlarm(int index)
{
return context.PushAlarms.Where(x => x.Id > index).ToList();
}
[HttpGet, Route("setalarm")]
public bool SetAlarm(string title,string contents)
{
try
{
context.PushAlarms.Add(new PushAlarm {Title = title,Contents = contents,AlarmTime = DateTime.Now});
context.SaveChanges();
return true;
}
catch (Exception e)
{
return false;
}
}
}
}