예제 #1
0
        public IActionResult Delete(int id)
        {
            var result = _customerService.Delete(id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
예제 #2
0
 // DELETE api/apartments/5
 public HttpResponseMessage Delete(long id)
 {
     try
     {
         _apartmentService.Delete(id);
         return(Request.CreateResponse(System.Net.HttpStatusCode.Accepted));
     }
     catch
     {
         return(Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError));
     }
 }
예제 #3
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 oldApartment = _apartmentService.Delete(id);
                    _apartmentService.SaveChanges();

                    var responseData = Mapper.Map <Apartment, ApartmentViewModel>(oldApartment);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
예제 #4
0
 public ActionResult Delete(int id)
 {
     return(Ok(apartmentService.Delete(id)));
 }
 public IActionResult Delete(string id)
 {
     _apartmentService.Delete(id);
     return(RedirectToAction("Index", "Owner"));
 }
 public async Task Delete(Guid id)
 {
     await _apartmentService.Delete(id);
 }