public ActionResult HubOwnerUpdate([DataSourceRequest] DataSourceRequest request, HubUserViewModel userhub) { if (userhub != null && ModelState.IsValid) { UserHub result = _userHubService.FindById(userhub.UserHubID); if (result != null) { result.UserProfileID = userhub.UserProfileID; result.HubID = userhub.HubID; _userHubService.EditUserHub(result); } } return(Json(new[] { userhub }.ToDataSourceResult(request, ModelState))); }
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, HubUserViewModel userwarehouse) { if (ModelState.IsValid) { _userHubService.EditUserHub(BindUserOwner(userwarehouse)); return(Json(new { success = true })); } ViewBag.UserProfileID = new SelectList(_userProfileService.GetAllUserProfile(), "UserProfileID", "UserName", userwarehouse.UserProfileID); ViewBag.WarehouseID = new SelectList(_hubService.GetAllHub(), "HubID", "Name", userwarehouse.HubID); return(RedirectToAction("index")); }
public ActionResult Edit(UserHub userwarehouse) { if (ModelState.IsValid) { _userHubService.EditUserHub(userwarehouse); //db.UserHubs.Attach(userwarehouse); //db.ObjectStateManager.ChangeObjectState(userwarehouse, EntityState.Modified); ////if (userwarehouse.IsDefault == "1") ////{ //// var uProfile = userwarehouse.UserProfile; //// uProfile.ChangeWarehouse(userwarehouse.UserWarehouseID); ////} //db.SaveChanges(); //return RedirectToAction("Index"); return(Json(new { success = true })); } ViewBag.UserProfileID = new SelectList(_userProfileService.GetAllUserProfile(), "UserProfileID", "UserName", userwarehouse.UserProfileID); ViewBag.WarehouseID = new SelectList(_hubService.GetAllHub(), "HubID", "Name", userwarehouse.HubID); return(View(userwarehouse)); }