public IActionResult Post(AAASSOSRequest sosRequest) { try { AAASSOS SOSModel = sosRequest.Adapt <AAASSOS>(); using (AAASSOSService ASService = new AAASSOSService()) { ASService.Add(SOSModel, 1, "AAAS User"); } using (NotificationService notificationService = new NotificationService()) { Notifications notificationModel = new Notifications(); notificationModel.NotificationContent = "A SOS was reported by " + SOSModel.UserContactNumber; notificationModel = notificationService.Add(notificationModel, 1, "AAAS User"); _hubContext.Clients.Group((notificationModel.SubscriberId).ToString()).PushNotification(notificationModel); } } catch (Exception ex) { Sentry.SentrySdk.CaptureException(ex); } return(Ok()); //status code 200 }
public bool Update(AAASSOS ASModel) { try { using (AAASSOSRepository ASRepo = new AAASSOSRepository()) { ASRepo.Update(ASModel); return(true); } } catch (Exception ex) { throw ex; } }
public AAASSOS GetById(int id) { try { using (AAASSOSRepository ASRepo = new AAASSOSRepository()) { AAASSOS ASModel = new AAASSOS(); { ASModel = ASRepo.Get <AAASSOS>(id); return(ASModel); } } } catch (Exception ex) { throw ex; } }
public AAASSOS Add(AAASSOS ASModel, int SubscriberId, string UserName) { try { using (AAASSOSRepository ASRepo = new AAASSOSRepository()) { if (ASModel != null) { ASModel.CreatedOn = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubscriberId)); ASModel.CreatedBy = UserName; var rowId = ASRepo.Insert(ASModel); ASModel.Id = rowId; } return(ASModel); } } catch (Exception ex) { throw ex; } }