private static List <ServiceDetail> GetSectionChildrens(ServiceDetailRegisterViewModel s) { if (s.Sections == null) { return(new List <ServiceDetail>()); } return(s.Sections.Select(x => new ServiceDetail() { GroupName = x.GroupName, HasPhoto = x.HasPhoto, Id = (!string.IsNullOrEmpty(x.Id)) ? Guid.Parse(x.Id):Guid.Empty, IdSection = x.IdSection, IdService = string.IsNullOrEmpty(x.IdService) ? (Guid?)null : Guid.Parse(x.IdService), IsDynamic = x.IsDynamic, Order = x.Order, SectionTitle = x.SectionTitle, Weight = x.Weight, StatusRegister = x.StatusRegister, Questions = x.Questions.Select(q => new Question() { Id = (!string.IsNullOrEmpty(q.Id)) ? Guid.Parse(q.Id):Guid.Empty, IdServiceDetail = (!string.IsNullOrEmpty(q.IdServiceDetail)) ? Guid.Parse(q.IdServiceDetail):Guid.Empty, Title = q.Title, StatusRegister = q.StatusRegister, Order = q.Order, Weight = q.Weight, IdTypePoll = Guid.Parse(q.IdTypePoll), HasPhoto = q.HasPhoto ? "S" : "N", CountPhoto = 0, AnswerRequired = q.AnswerRequired, Aggregatefield = q.Aggregatefield, QuestionDetails = q.QuestionDetails.Select(qd => new QuestionDetail() { Id = (!string.IsNullOrEmpty(qd.Id)) ? Guid.Parse(qd.Id):Guid.Empty, IdQuestion = (!string.IsNullOrEmpty(qd.IdQuestion)) ? Guid.Parse(qd.IdQuestion):Guid.Empty, Order = qd.Order, Weight = qd.Weight, Answer = qd.Answer, IdQuestionLink = (!string.IsNullOrEmpty(qd.IdQuestionLink)) ? Guid.Parse(qd.IdQuestionLink) : (Guid?)null, IsNext = "N", StatusRegister = qd.StatusRegister , Aggregatefield = qd.Aggregatefield , Idconcept = qd.Idconcept }).ToList() }).ToList() }) .ToList()); }
public JsonResult AddSection() { var model = new ServiceDetailRegisterViewModel(); return(Json(model)); }