Exemple #1
0
 public bool Update(AAASIncident AIModel)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             AIRepo.Update(AIModel);
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public AAASIncident GetById(int id)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             AAASIncident AIModel = new AAASIncident();
             {
                 AIModel = AIRepo.Get <AAASIncident>(id);
                 return(AIModel);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public AAASIncident Add(AAASIncident AIModel, int SubscriberId, string UserName)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             if (AIModel != null)
             {
                 AIModel.CreatedOn = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubscriberId));
                 AIModel.CreatedBy = UserName;
                 var rowId = AIRepo.Insert(AIModel);
                 AIModel.Id = rowId;
             }
             return(AIModel);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
 public IActionResult Post(AAASIncidentRequest incidentRequest)
 {
     try
     {
         AAASIncident AIModel = incidentRequest.Adapt <AAASIncident>();
         using (AAASIncidentService AIService = new AAASIncidentService())
         {
             AIService.Add(AIModel, 1, "AAAS User");
         }
         using (NotificationService notificationService = new NotificationService())
         {
             Notifications notificationModel = new Notifications();
             notificationModel.NotificationContent = "An incident(" + AIModel.IncidentType + ") was reported by " + AIModel.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());
 }