コード例 #1
0
        public async Task <ResponceModel> Delete([FromRoute] int id)
        {
            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
            {
                roomTypeService.Delete(id);
                if (await roomTypeService.SaveChanges())
                {
                    return(new ResponceModel(200, "OK", null, null));
                }
                else
                {
                    return(new ResponceModel(400, "ERROR", null, new string[] { "Veri silinirken 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 silinirken sorun oluştu." }));
            }
        }
コード例 #2
0
        public HttpResponseMessage Delete(string id)
        {
            var svc = new RoomTypeService();

            svc.Delete(id);
            return(Request.CreateResponse(HttpStatusCode.NoContent));
        }
コード例 #3
0
 public HttpResponseMessage Delete(string id)
 {
     return(Execute(session =>
     {
         RoomTypeService.Delete(id);
         return new HttpResponseMessage(HttpStatusCode.NoContent);
     }));
 }
コード例 #4
0
ファイル: RoomTypeController.cs プロジェクト: soncat1/Movie
 public ActionResult Delete(int id, RoomType roomType)
 {
     try
     {
         roomType = roomTypeService.GetRoomType(id);
         roomTypeService.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Không thể xóa loại phòng chiếu");
     }
     return(View(roomType));
 }
コード例 #5
0
 public int Delete(int rtypeid)
 {
     return(_dao.Delete(rtypeid));
 }