public PartialViewResult ShowPreSetSteps(int acitveId) { ViewData ["activeId"] = acitveId; var service = new PreSetStepService(); return(PartialView("_PreSetSteps", service.GetAll())); }
public PartialViewResult AddPreSetStepToActive(int activeId) { var ids = new List <int> (); foreach (var key in Request.Form.AllKeys) { if (key.IndexOf("pss") != 0) { continue; } var selected = (Request.Form [key] == "true,false"); if (selected) { ids.Add(int.Parse(key.Replace("pss", ""))); } } var psss = new PreSetStepService(); var pss = psss.GetByIds(ids); var service = new ActiveService(); var active = service.GetById(activeId); foreach (var s in pss) { var nas = new ActiveStep() { OrderId = (active.Steps.Count + 1), Content = s.Content, Description = s.Description, UserDescription = s.Description }; active.Steps.Add(nas); } service.UpdateSteps(activeId, active.Steps); return(PartialView("_ActiveSteps", active)); }