private async Task <PanicAlerts> buildUpdate(CreatePanicAlertRequest model) { var panicAlert = await PanicService.GetByIdAsync(model.alertId.DeCryptId()); panicAlert.panicStatus = PanicStatus.INPROGRESS.ToString(); panicAlert.updated_at = DateTime.Now; panicAlert.supportId = model.supportId.DeCryptId(); return(panicAlert); }
private PanicAlerts buildPanic(CreatePanicAlertRequest model) { return(new PanicAlerts { alertId = 0, alertType = model.alertType, panicStatus = model.panicStatus, isActive = model.isActive, latitude = model.latitude, longitude = model.longitude, create_at = DateTime.Now, profileId = model.profileId.DeCryptId(), supportId = 0 }); }
public async Task <IActionResult> TakeOnPanicAlert(CreatePanicAlertRequest model) { try { if (ModelState.IsValid) { var response = await PanicService.UpdateAsync(await buildUpdate(model)); if (response != null) { return(Ok(new ApiResponse <PanicAlerts>().Success(response))); } throw new HttpException(400, "No record updated"); } throw new HttpException(400, "failed"); } catch (Exception ex) { return(AppError(ex)); } }