public ActionResult SParts_Update([DataSourceRequest] DataSourceRequest request, SPartViewModel spartVM)
        {
            if (spartVM != null && ModelState.IsValid)
            {
                var spart = spartTasks.One(spartVM.SPartID);
                if (spart != null)
                {
                    ConvertToSPart(spartVM, spart);

                    spart.ModifiedDate = DateTime.Now;
                    spart.ModifiedBy   = User.Identity.Name;
                    spart.DataStatus   = "Updated";

                    spartTasks.Update(spart);
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }
 private void ConvertToWOSPart(RequestWOSPartViewModel WOVM, TWOSPart woSPart)
 {
     woSPart.WOId               = _woTasks.One(WOVM.WOId);
     woSPart.SPartId            = string.IsNullOrEmpty(WOVM.SPartId) ? null : _spartTasks.One(WOVM.SPartId);
     woSPart.WOSPartPrice       = WOVM.WOSPartPrice;
     woSPart.WOSPartTotal       = WOVM.WOSPartTotal;
     woSPart.WOSPartQty         = WOVM.WOSPartQty;
     woSPart.WOSPartDisc        = WOVM.WOSPartDisc;
     woSPart.WOSPartDate        = WOVM.WOSPartDate;
     woSPart.WOSPartStatus      = EnumWOSPartStatus.Request.ToString();
     woSPart.WOSPartRequestBy   = string.IsNullOrEmpty(WOVM.WOSPartRequestBy) ? null : _empTasks.One(WOVM.WOSPartRequestBy);
     woSPart.WOSPartDateRequest = WOVM.WOSPartDate;
 }