public ActionResult SaveOrUpdate(CommonCode obj) { if (obj.Id > 0) { obj = this.CommonCodeRepository.Get(obj.Id); TryUpdateModel(obj); } obj = this.CommonCodeRepository.SaveOrUpdate(obj); return JsonSuccess(obj); }
public ActionResult Edit(int? id,int? parentid,CommonCodeType? type) { CommonCode item = null; if (id.HasValue) { item = this.CommonCodeRepository.Get(id.Value); } if (item == null && parentid.HasValue && type.HasValue) { item = new CommonCode(); item.Type = type.Value; item.Parent = this.CommonCodeRepository.Get(parentid.Value); } return View(item); }
public ActionResult Edit(int? id, int? parentid, CommonCodeType? type) { CommonCode item = null; String viewName = "Edit"; if (id.HasValue) { item = this.CommonCodeRepository.Get(id.Value); } if (item == null && parentid.HasValue && type.HasValue) { item = new CommonCode(); item.Type = type.Value; item.Parent = this.CommonCodeRepository.Get(parentid.Value); } if (item != null) { viewName += ParseExtName(item.Type); } return View(viewName,item); }
public static CommonCodeModel From(CommonCode commonCode) { return new CommonCodeModel(commonCode); }
public CommonCodeModel(CommonCode commonCode) { this.Id = commonCode.Id; this.ParentId = 0; if(commonCode.Parent != null) this.ParentId = commonCode.Parent.Id; this.Name = commonCode.Name; this.FullName = commonCode.FullNameString(); this.Note = commonCode.Note; }
public CommonCodeModel(CommonCode commonCode) { this.Id = commonCode.Id; this.ParentId = 0; if (commonCode.Parent != null) this.ParentId = commonCode.Parent.Id; this.Name = commonCode.Name; this.FullName = commonCode.FullNameString(); this.CodeNo = commonCode.CodeNo; this.ParamString = commonCode.ParamString; this.ParamFlag = commonCode.ParamFlag; this.ParamDecimal = commonCode.ParamDecimal; this.Note = commonCode.Note; }