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

            if (model.Id == 0)
            {
                var time = model.ActionDate.ToShortDateString().Substring(0, 10) + " " + model.ActionTime + ":00";
                var date = DateTime.Parse(time);
                var note = new PersonAntiSocialBehaviourCaseNoteDto
                {
                    Note       = model.Notes,
                    ActionDate = date
                };
                model.PersonAntiSocialBehaviourCaseNotes.Add(note);
                model = _customerFacadeApiClient.PostPersonAntiSocialBehaviour(model).Result;
            }
            else
            {
                model = _customerFacadeApiClient.PutPersonAntiSocialBehaviour(model.Id, model).Result;
            }
            success = string.IsNullOrWhiteSpace(model.ErrorMessage);
            return(Json(new { success, message = success ? model.SuccessMessage : model.ErrorMessage }));
        }