コード例 #1
0
 public HttpResponseMessage Update(RoomType roomType)
 {
     return(Execute(session =>
     {
         RoomTypeService.Update(roomType);
         return new HttpResponseMessage(HttpStatusCode.NoContent);
     }));
 }
コード例 #2
0
        public HttpResponseMessage Update(RoomType roomType)
        {
            var svc = new RoomTypeService();

            svc.Update(roomType);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
コード例 #3
0
ファイル: RoomTypeController.cs プロジェクト: soncat1/Movie
 public ActionResult Edit(RoomType roomType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             roomTypeService.Update(roomType);
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Không thể thay đổi thông tin loại phòng chiếu!");
     }
     return(View(roomType));
 }
コード例 #4
0
        public async Task <ResponceModel> Update([FromRoute] int id, [FromBody] ResidenceTypeDTO model)
        {
            var identifier = User.Claims.FirstOrDefault(p => p.Type == "id");

            if (identifier == null)
            {
                return(new ResponceModel(401, "FAILED", null, new string[] { "Yetkilendirme Hatası." }));
            }
            if (id == 0)
            {
                return(new ResponceModel(404, "ERROR", null, new string[] { "Güncellenecek veri bulunamadı." }));
            }
            try
            {
                var roomType = await roomTypeService.Get(id);

                if (roomType == null)
                {
                    return(new ResponceModel(404, "ERROR", null, new string[] { "Güncellenecek veri bulunamadı." }));
                }
                roomType = model.Adapt <RoomType>();
                roomTypeService.Update(roomType);
                if (await roomTypeService.SaveChanges())
                {
                    return(new ResponceModel(200, "OK", roomType, null));
                }
                else
                {
                    return(new ResponceModel(400, "ERROR", null, new string[] { "Veri güncellenirken sorun oluştu." }));
                }
            }
            catch (Exception ex)
            {
                await _logService.Add(new SystemLog()
                {
                    Content = ex.Message, CreateDate = DateTime.Now, UserId = 0, EntityName = roomTypeService.GetType().Name
                });

                return(new ResponceModel(500, "ERROR", null, new string[] { "Veri güncellenirken sorun oluştu." }));
            }
        }
コード例 #5
0
 /// <summary>
 /// Using modified model to update
 /// </summary>
 /// <param name="model">entity</param>
 /// <returns>return how many rows have effected</returns>
 public int Update(RoomType model)
 {
     return(_dao.Update(model));
 }