Пример #1
0
        public IActionResult Save(PersonAlertDto model)
        {
            bool success;

            if (model.Id == 0)
            {
                var lookup = GetLookupModel();
                model.AlertStatusId = lookup?.AlertStatuses.FirstOrDefault(x => x.Name == "Active")?.Id;
                model.RaisedOn      = DateTime.Now;
                model = _customerFacadeApiClient.PostPersonAlert(model).Result;
            }
            else
            {
                model = _customerFacadeApiClient.PutPersonAlert(model.Id, model).Result;
            }

            success = string.IsNullOrWhiteSpace(model.ErrorMessage);
            return(Json(new { success, message = success ? model.SuccessMessage : model.ErrorMessage }));
        }