public ActionResult POList_Update([DataSourceRequest] DataSourceRequest request, TransPOViewModel vm) { if (vm != null && ModelState.IsValid) { var entity = _tasks.One(vm.TransId); if (entity != null) { ConvertToJmInventoryTTran(vm, entity); entity.ModifiedDate = DateTime.Now; entity.ModifiedBy = User.Identity.Name; entity.DataStatus = EnumDataStatus.Updated.ToString(); _tasks.Update(entity); } } return(Json(ModelState.ToDataSourceResult())); }
public ActionResult PODetail_Create(string TransId, [DataSourceRequest] DataSourceRequest request, TransPODetViewModel vm) { if (vm != null && ModelState.IsValid) { JmInventoryTTransDet entity = new JmInventoryTTransDet(); entity.SetAssignedIdTo(Guid.NewGuid().ToString()); entity.TransId = string.IsNullOrEmpty(TransId) ? null : _JmInventoryTTranTasks.One(TransId); ConvertToJmInventoryTTransDet(vm, entity); entity.CreatedDate = DateTime.Now; entity.CreatedBy = User.Identity.Name; entity.DataStatus = EnumDataStatus.New.ToString(); _tasks.Insert(entity); } return(Json(new[] { vm }.ToDataSourceResult(request, ModelState))); }