コード例 #1
0
        public JsonResult UpdateRoomType(RoomTypeVM model)
        {
            if (model.Id <= 0)
            {
                RedirectToAction(nameof(RoomTypeList)); // ErrorHandle eklenecek
            }

            if (!ModelState.IsValid)
            {
                return(base.JSonModelStateHandle());
            }

            ServiceResultModel <RoomTypeVM> serviceResult = _roomTypeService.UpdateRoomType(model);

            if (!serviceResult.IsSuccess)
            {
                base.UIResponse = new UIResponse
                {
                    Message    = string.Format("Operation Is Not Completed, {0}", serviceResult.Message),
                    ResultType = serviceResult.ResultType,
                    Data       = serviceResult.Data
                };
            }
            else
            {
                base.UIResponse = new UIResponse
                {
                    Data       = serviceResult.Data,
                    ResultType = serviceResult.ResultType,
                    Message    = "Success"
                };
            }

            return(Json(base.UIResponse, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: RoomTypeBLL.cs プロジェクト: zanderphh/HotelManager
 /// <summary>
 /// 修改房间类型
 /// </summary>
 /// <param name="roomType"></param>
 public static void UpdateRoomType(RoomType roomType)
 {
     try
     {
         RoomTypeService.UpdateRoomType(roomType);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
        public string UpdateRoomType(RoomType rt)
        {
            string message  = string.Empty;
            string TypeName = rt.TypeName;
            int    TypeID   = 0;

            TypeID = hotelService.UpdateRoomType(rt);
            if (TypeID > 0)
            {
                message = "更新成功!";
            }
            else
            {
                message = "更新失败!";
            }
            return(message);
        }
コード例 #4
0
        public ActionResult Edit(int id, RoomTypeViewModel model)
        {
            try
            {
                bool result = _roomTypeService.UpdateRoomType(model);

                if (result)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                throw new Exception();
            }
            catch
            {
                ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
                return(View());
            }
        }
コード例 #5
0
 //修改一个房间类型
 public static int UpdateRoomType(RoomType roomType)
 {
     return(RoomTypeService.UpdateRoomType(roomType));
 }
コード例 #6
0
ファイル: RoomTypeManager.cs プロジェクト: isMrH/College
 //修改数据
 public int UpdateRoomType(RoomType rt)
 {
     return(rtservice.UpdateRoomType(rt));
 }