public ActionResult JmInventoryMSuppliers_Update([DataSourceRequest] DataSourceRequest request, JmInventoryMSupplierViewModel vm) { if (vm != null && ModelState.IsValid) { var entity = _tasks.One(vm.SupplierId); if (entity != null) { ConvertToJmInventoryMSupplier(vm, entity); entity.ModifiedDate = DateTime.Now; entity.ModifiedBy = User.Identity.Name; entity.DataStatus = EnumDataStatus.Updated.ToString(); _tasks.Update(entity); } } return(Json(ModelState.ToDataSourceResult())); }
private void ConvertToJmInventoryTTran(TransPOViewModel vm, JmInventoryTTran entity) { entity.SupplierId = string.IsNullOrEmpty(vm.SupplierId) ? null : _JmInventoryMSupplierTasks.One(vm.SupplierId); //entity.TransRefId = string.IsNullOrEmpty(vm.TransRefId) ? null : _JmInventoryTTranTasks.One(vm.TransRefId); entity.TransNo = vm.TransNo; entity.TransDate = vm.TransDate; //entity.TransStatus = vm.TransStatus; //entity.TransApprovedBy = vm.TransApprovedBy; //entity.TransApprovedDate = vm.TransApprovedDate; //entity.TransInputBy = vm.TransInputBy; //entity.TransInputDate = vm.TransInputDate; entity.InvoiceNo = vm.InvoiceNo; entity.TransDesc = vm.TransDesc; ///calculate total base on detail CalculateTotal(vm.TransId, entity); }