Example #1
0
 public ActionResult DeleteLocation(long id)
 {
     try{
         _locationService.DeleteLocation(id);
         return(Ok("Location deleted!"));
     }catch (Exception e) {
         return(BadRequest(e.Message));
     }
 }
 public IActionResult DeleteLocation(Locations location)
 {
     try
     {
         locationServices.DeleteLocation(location);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Example #3
0
        public async Task <IActionResult> Delete(string locationId)
        {
            var locationDel = _locationServices.GetLocation(locationId);

            if (await _locationServices.DeleteLocation(locationDel))
            {
                var userMessage = new MessageVM()
                {
                    CssClassName = "alert alert-success ", Title = "Thành công", Message = "Đã xóa địa điểm thành công"
                };
                TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage);
            }
            else
            {
                var userMessage = new MessageVM()
                {
                    CssClassName = "alert alert-danger", Title = "Không thành công", Message = "Đã có lỗi khi thao tác, xin mời thử lại"
                };
                TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage);
            }
            return(RedirectToAction(actionName: "Index", controllerName: "Location"));
        }
Example #4
0
 public ActionResult DeleteConfirmed(string id)
 {
     service.DeleteLocation(id);
     return(RedirectToAction("Index"));
 }