public ActionResult Duplicate(int id, string userName) { // TODO: Move duplication functionality to the service layer WorkAssignment _assignment = waServ.Get(id); WorkAssignment duplicate = (WorkAssignment)_assignment.Clone(); duplicate.ID = 0; duplicate.workerAssigned = null; duplicate.workerAssignedID = null; duplicate.workerSiginin = null; duplicate.workerSigninID = null; var saved = waServ.Create(duplicate, userName); var result = map.Map <WorkAssignment, ViewModel.WorkAssignment>(saved); return(Json(new { sNewRef = result.tabref, sNewLabel = result.tablabel, iNewID = result.ID })); }
public ActionResult Duplicate(int id, string userName) { // // TODO: Move duplication functionality to the service layer Domain.WorkAssignment _assignment = waServ.Get(id); Domain.WorkAssignment duplicate = _assignment; duplicate.workerAssigned = null; duplicate.workerAssignedID = null; duplicate.workerSiginin = null; duplicate.workerSigninID = null; var saved = waServ.Create(duplicate, userName); var result = map.Map <Domain.WorkAssignment, ViewModel.WorkAssignment>(saved); return(Json(new { sNewRef = result.tabref, sNewLabel = result.tablabel, iNewID = result.ID }, JsonRequestBehavior.AllowGet)); }
// GET api/values/5 public IHttpActionResult Get(int id) { var result = map.Map <Domain.WorkAssignment, Web.ViewModel.Api.WorkAssignment>(serv.Get(id)); return(Json(new { data = result })); }