コード例 #1
0
 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)));
 }
コード例 #2
0
ファイル: UserWarehouse.cs プロジェクト: nathnael/cats
        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"));
        }
コード例 #3
0
ファイル: UserWarehouseController.cs プロジェクト: IYoni/cats
 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));
 }