Esempio n. 1
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                var identity = (ClaimsIdentity)User.Identity;

                IEnumerable<Claim> claims = identity.Claims;

                var sizeData = _sizeService.Delete(id);

                _sizeService.Save();

                Log log = new Log()
                {
                    AppUserId = claims.FirstOrDefault().Value,
                    Content = Notification.DELETE_SIZE,
                    Created = DateTime.Now
                };

                _logService.Create(log);

                _logService.Save();

                var responseData = Mapper.Map<Size, SizeViewModel>(sizeData);

                response = request.CreateResponse(HttpStatusCode.OK, responseData);

                return response;
        
            });
        }
Esempio n. 2
0
        public ActionResult Delete(int id)
        {
            var size = _sizeService.GetbyId(id);

            _sizeService.Delete(size);
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public IActionResult Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         return(new BadRequestObjectResult(ModelState));
     }
     _sizeService.Delete(id);
     _sizeService.SaveChanges();
     return(new OkObjectResult(id));
 }
Esempio n. 4
0
 public IActionResult Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
         return(new BadRequestObjectResult(allErrors));
     }
     _sizeService.Delete(id);
     _sizeService.Save();
     return(new NoContentResult());
 }
Esempio n. 5
0
        public async Task <IActionResult> Delete([Required] int id)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }
            await _sizeService.Delete(id);

            _sizeService.SaveChanges();
            return(new OkObjectResult(id));
        }
Esempio n. 6
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var oldSize = _sizeService.Delete(id);
                    _sizeService.Save();

                    var responseData = Mapper.Map <Size, SizeViewModel>(oldSize);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
Esempio n. 7
0
        public async Task <IActionResult> Delete(int id)
        {
            var res = await sizeService.Delete(id);

            if (res)
            {
                return(Ok("Success"));
            }
            else
            {
                return(NotFound("Object not found"));
            }
        }
Esempio n. 8
0
 public IActionResult Delete(int id)
 {
     if (id > 0)
     {
         var status = _sizeService.Delete(id);
         _sizeService.Save();
         if (status)
         {
             return(new OkObjectResult(new { Status = status, Message = "Xóa màu thành công" }));
         }
         return(new OkObjectResult(new { Status = status, Message = "Xóa màu không thành công" }));
     }
     return(new OkObjectResult(new { Status = false, Message = "Màu không tồn tại" }));
 }
 public ActionResult Delete(int id)
 {
     try
     {
         _sizeService.Delete(id);
         _sizeService.CommitChanges();
         AlertSuccess(InfoString.DELETE_SUCCESSFULL);
     }
     catch (Exception ex)
     {
         Log(ex);
         AlertError(InfoString.ERROR_SYSTEM);
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 10
0
        public ActionResult DeleteConfirmed(ReasonViewModel vm)
        {
            List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

            if (ModelState.IsValid)
            {
                var temp = _SizeService.Find(vm.id);

                LogList.Add(new LogTypeViewModel
                {
                    ExObj = temp,
                });

                // Now delete the Parent Size
                _SizeService.Delete(temp.SizeId);

                XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(PartialView("_Reason", vm));
                }

                LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                {
                    DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Size).DocumentTypeId,
                    DocId           = vm.id,
                    ActivityType    = (int)ActivityTypeContants.Deleted,
                    UserRemark      = vm.Reason,
                    xEModifications = Modifications,
                }));

                return(Json(new { success = true }));
            }
            return(PartialView("_Reason", vm));
        }
Esempio n. 11
0
 public IActionResult Delete(int id)
 {
     _pizzaSizeService.Delete(id);
     return(StatusCode(StatusCodes.Status200OK, "Succesufuly deleted!"));
 }
Esempio n. 12
0
        public async Task <OkObjectResult> DeleteSectors(int id)
        {
            var delResult = await sizeService.Delete(id);

            return(Ok(delResult));
        }
Esempio n. 13
0
        public IActionResult Delete(int id)
        {
            _sizeService.Delete(id);

            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
 public IHttpActionResult Delete(int sizeId)
 {
     _service.Delete(sizeId);
     return(Ok());
 }