Пример #1
0
        private async Task <PanicAlerts> buildPanicResolution(PanicAlertResolutionRequest model)
        {
            var panicAlert = await PanicService.GetByIdAsync(model.alertId.DeCryptId());

            panicAlert.panicStatus = PanicStatus.RESOLVED.ToString();
            panicAlert.isActive    = false;
            panicAlert.updated_at  = DateTime.Now;
            return(await PanicService.UpdateAsync(panicAlert));
        }
Пример #2
0
        public bool CreatePanicAlertResolution(PanicAlertResolutionRequest model)
        {
            var context    = (ApplicationDbContext)DbContext;
            var resolution = new PanicAlertResolution()
            {
                alertResolutionId   = 0,
                alertId             = model.alertId.DeCryptId(),
                supportId           = model.supportId.DeCryptId(),
                resolutionStatement = model.resolutionStatement,
                create_at           = DateTime.Now
            };

            context.PanicAlertResolution.Add(resolution);
            context.SaveChanges();
            return(true);
        }
Пример #3
0
        public async Task <IActionResult> CreatePanicAlertResolution(PanicAlertResolutionRequest model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await buildPanicResolution(model);

                    var response = PanicService.CreatePanicAlertResolution(model);
                    if (response != false)
                    {
                        return(Ok(new ApiResponse <bool>().Success(response)));
                    }
                    throw new HttpException(400, "Panic Alert resolution not created");
                }
                throw new HttpException(400, "failed");
            }
            catch (Exception ex)
            {
                return(AppError(ex));
            }
        }
Пример #4
0
 public bool CreatePanicAlertResolution(PanicAlertResolutionRequest model)
 {
     return(PanicRepository.CreatePanicAlertResolution(model));
 }