public ActionResult ApplyerEdit(TT_Trademark_Applyer model) { TtTrademarkApplyerBll bll = new TtTrademarkApplyerBll(); TT_Trademark_Applyer applyer = bll.Query(t => t.Id == model.Id).FirstOrDefault(); var baseType = new PdTypeBll().Query(t => t.TypeId == 5 || t.TypeId == 6 || t.TypeId == 8); ViewBag.DicNationality = baseType.Where(t => t.TypeId == 5).ToDictionary(t => t.Tid.ToInt(), t => t.Name); ViewBag.DicType = baseType.Where(t => t.TypeId == 6).ToDictionary(t => t.Tid.ToInt(), t => t.Name); ViewBag.DicCerificateType = baseType.Where(t => t.TypeId == 8).ToDictionary(t => t.Tid.ToInt(), t => t.Name); if (applyer == null) { applyer = model; bll.Add(applyer); } else { applyer.Name = model.Name; //applyer.Remark = model.Remark; bll.Update(applyer); return(View(applyer)); } ViewBag.Success = true; ViewBag.Message = "成功!"; return(View(applyer)); }
public ActionResult ApplyerEdit(int?id) { TT_Trademark_Applyer applyer = new TT_Trademark_Applyer(); if (id.ToInt() > 0) { TtTrademarkApplyerBll bll = new TtTrademarkApplyerBll(); applyer = bll.Query(t => t.Id == id).FirstOrDefault(); } var baseType = new PdTypeBll().Query(t => t.TypeId == 5 || t.TypeId == 6 || t.TypeId == 8); ViewBag.DicNationality = baseType.Where(t => t.TypeId == 5).ToDictionary(t => t.Tid.ToInt(), t => t.Name); ViewBag.DicType = baseType.Where(t => t.TypeId == 6).ToDictionary(t => t.Tid.ToInt(), t => t.Name); ViewBag.DicCerificateType = baseType.Where(t => t.TypeId == 8).ToDictionary(t => t.Tid.ToInt(), t => t.Name); ViewBag.allArea = new PdAreasBll().Query(t => true); //ViewBag.DicProvince = allArea.Where(t => t.Parent == "CN").ToDictionary(t => t.Id, t => t.Name); //ViewBag.DicCity = allArea.Where(t => t.Parent == (applyer.Province == null ? "110000" : applyer.Province )).ToDictionary(t => t.Id, t => t.Name); //ViewBag.DicDistrict = allArea.Where(t => t.Parent == (applyer.City == null ? "110100" : applyer.City)).ToDictionary(t => t.Id, t => t.Name); return(View(applyer)); }