Esempio n. 1
0
 public ActionResult DirectorDelete(int id)
 {
     _directorService.DeleteDirector(id);
     TempData[UserMessages.UserMessage] = new MessageViewModel()
     {
         CssClass = "alert-success",
         Message  = Resources.DirectorRemovedSuccesfully
     };
     return(RedirectToAction("ViewDirectors", "Moderator"));
 }
Esempio n. 2
0
        public async Task <IHttpActionResult> DeleteAsync(string directorName)
        {
            await Task.Yield();

            if (directorName == "")
            {
                return(BadRequest("Director name can not be empty"));
            }
            try
            {
                directorService.DeleteDirector(directorName);
                return(Content(HttpStatusCode.Created, $"{directorName} created"));
            }
            catch (DataBaseException)
            {
                return(Content(HttpStatusCode.NotFound, $"{directorName} does not exist in our servers"));
            }
            catch (BussinesLogicException)
            {
                return(Content(HttpStatusCode.Accepted, $"{directorName} has asociated movies"));
            }
        }