public ActionResult EditOrder(long id) { currentuser = GetUserAu(); t_siz_orders current = repository.GetById(id, typeof(t_siz_orders).ToString()) as t_siz_orders; if (current != null && currentuser.department != null) { int selectIndex = 1; SelectList Goods = new SelectList(repository.SIZGoodsList.Where(p => p.deleted != 1), "id", "name", current.goods); ViewBag.Goodss = Goods; List <long> lgs = repository.GoodSize.Where(s => s.good == current.goods).Select(p => p.size).ToList(); List <t_siz_goods_size> sizes = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id))); //sizes.Add(new t_siz_goods_size() { id = 0, size = string.Empty }); SelectList Sizes = new SelectList(sizes, "id", "size"); ViewBag.Sizes = Sizes; return(PartialView("EditOrder", current)); } return(PartialView("Error")); }
public ActionResult EditOrder(long id, long identificator = 0) { currentuser = GetUserAu(); ViewBag.Ident = identificator; t_siz_orders current = repository.GetById(id, typeof(t_siz_orders).ToString()) as t_siz_orders; if (current != null && currentuser.department != null) { int selectIndex = 1; SelectList Goods = new SelectList(repository.SIZGoodsList.Where(p => p.deleted != 1).OrderBy(t => t.name), "id", "name", current.goods); ViewBag.Goodss = Goods; List <long> lgs = repository.GoodSize.Where(s => s.good == current.goods).Select(p => p.size).ToList(); List <t_siz_goods_size> sizes = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id))); //sizes.Add(new t_siz_goods_size() { id = 0, size = string.Empty }); SelectList Sizes = new SelectList(sizes, "id", "size"); ViewBag.Sizes = Sizes; List <int> q = new List <int>() { 0, 0, 0, 0 }; foreach (var t in paramet.quarter.Split(',')) { q[int.Parse(t.Trim()) - 1] = 1; } ViewBag.Quarters = q; return(PartialView("EditOrder", current)); } return(PartialView("Error")); }