api 5045포트 연결
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user