public PropertyListingTypeVo update(PropertyListingTypeVo input, int?propertyListingTypeId = null) { using (var db = new MainDb()) { if (propertyListingTypeId == null) { propertyListingTypeId = input.propertyListingTypeId; } var res = db.propertyListingTypes.FirstOrDefault(e => e.propertyListingTypeId == propertyListingTypeId); if (res == null) { return(null); } input.created = res.created; // input.createdBy = res.createdBy; db.Entry(res).CurrentValues.SetValues(input); db.SaveChanges(); return(res); } }
public PropertyListingTypeVo insert(PropertyListingTypeVo input) { using (var db = new MainDb()) { db.propertyListingTypes.Add(input); db.SaveChanges(); return(input); } }
public ActionResult Edit(int id, PropertyListingTypeVo input) { if (this.ModelState.IsValid) { var res = propertyListingTypeManager.update(input, id); return(RedirectToAction("Index")); } return(View(input)); }
public ActionResult Create(PropertyListingTypeVo input) { if (this.ModelState.IsValid) { var item = propertyListingTypeManager.insert(input); return(RedirectToAction("Index")); } return(View(input)); }
public ActionResult Create() { var vo = new PropertyListingTypeVo(); return(View(vo)); }