Example #1
0
        public async Task <JsonResult> EditChildMedicalInformation(ChildEditMedicalViewModel model)
        {
            if (ModelState.IsValid)
            {
                var person = await _unitOfWork.People.GetOneAsync(x => x.Id == model.PersonId,
                                                                  include : p => p.Include(w => w.ChildInfo).Include(x => x.PersonToClasses));

                person.Update(model);
                var result = await _unitOfWork.SaveAsync();

                if (result.Succeeded)
                {
                    return(Json(new JsonMessage {
                        Color = "#ff6849", Message = "Person medical saved", Header = "Success", Icon = "success", AdditionalData = model
                    }));
                }
                return(Json(new JsonMessage {
                    Color = "#ff6849", Message = "Error", Header = "Error", Icon = "error", AdditionalData = model
                }));
            }
            return(Json(new JsonMessage {
                Color = "#ff6849", Message = "Error", Header = "Error", Icon = "error", AdditionalData = model
            }));
        }
Example #2
0
 public void Update(ChildEditMedicalViewModel model)
 {
     ChildInfo.Allergies      = model.Allergies;
     ChildInfo.AllergiesNotes = model.AllergiesNotes;
     ChildInfo.NextMedical    = model.NextMedical;
 }