Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            KHACHHANG kHACHHANG = service.Detail(id);

            kHACHHANG.isDeleted = 1;
            service.Delete(kHACHHANG);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Delete(string id)
        {
            var       result   = new TransferObj <bool>();
            KHACHHANG instance = await _service.Repository.FindAsync(id);

            if (instance == null)
            {
                return(NotFound());
            }
            try
            {
                _service.Delete(instance.ID);
                int del = await _service.UnitOfWork.SaveAsync();

                if (del > 0)
                {
                    result.Data    = true;
                    result.Status  = true;
                    result.Message = "Xóa thành công bản ghi";
                }
                else
                {
                    result.Data    = false;
                    result.Status  = false;
                    result.Message = "Thao tác không thành công";
                }
            }
            catch (Exception e)
            {
                result.Data    = false;
                result.Status  = false;
                result.Message = e.Message;
            }
            return(Ok(result));
        }
Exemplo n.º 3
0
 public HttpResponseMessage Delete(HttpRequestMessage request, int id)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         var delete = _khachHangService.Delete(id);
         var mapper = Mapper.Map <KhachHang, KhachHangViewModel>(delete);
         _khachHangService.SaveChange();
         response = request.CreateResponse(HttpStatusCode.OK, mapper);
         return response;
     }));
 }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateReponse(request, () => {
                HttpResponseMessage response;

                if (id != null)
                {
                    _ikhachHangService.Delete(id);
                    _ikhachHangService.save();
                    response = request.CreateResponse(System.Net.HttpStatusCode.Accepted, id);
                }
                else
                {
                    response = request.CreateResponse(System.Net.HttpStatusCode.BadRequest);
                }

                return response;
            }));
        }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                try
                {
                    _khachHangService.Delete(id);
                    _khachHangService.SaveChange();
                    response = request.CreateResponse(HttpStatusCode.OK, id);
                }
                catch (Exception)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest);
                }

                return response;
            }));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Delete(int ma)
        {
            var result = await _khachHangService.Delete(ma);

            return(Ok(result));
        }
        /// <summary>
        /// Deletes the specified value.
        /// </summary>
        /// <param name="value">The value.</param>
        public void Delete(int value)
        {
            var entity = currentService.GetById(value);

            currentService.Delete(entity);
        }