예제 #1
0
        public ActionResult Delete(Guid id)
        {
            try
            {
                string floorId = string.Empty;

                floorId = floorRepository.DeleteFloor(id, LogInManager.LoggedInUserId);

                if (!string.IsNullOrWhiteSpace(floorId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            FloorId = floorId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Floor details not deleted successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Delete");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }
 public ActionResult Delete(Guid id, FormCollection collection)
 {
     try
     {
         var userId = User.Identity.GetUserName();
         if (userRoleRepository.GetRoleByUserName(userId) != null && userRoleRepository.GetRoleByUserName(userId).IdUserType == "Admin")
         {
             // TODO: Add delete logic here
             floorRepository.DeleteFloor(id);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("Contact", "Home"));
         }
     }
     catch
     {
         ViewBag.Message_Delete = String.Format("The deletion of this floor is not possible, as it is currently in use. Please cancel all bookings from this floor first and then reattempt the deletion operation of the floor.");
         return(View("DeleteFloor"));
     }
 }