public ActionResult Create($Entity$Dto dto) { //Validate ModelStatec if (!ModelState.IsValid) { return(ReturnModelError(this.ModelState)); } try { //use service to add a new item _service$Entity$.Add$Entity$(dto); return(ReturnSuccess("Added successfuly")); } catch (Exception ex) { return(ReturnError(ex)); } }
public ActionResult Edit($Entity$Dto dto) { //Validate ModelStatec if (!ModelState.IsValid) { return(ReturnModelError(this.ModelState)); } try { //use service to update a new item _service$Entity$.Update$Entity$(dto); // return operation result return(ReturnSuccess("Updated successfuly")); } catch (Exception ex) { return(ReturnError(ex)); } }