public ActionResult CreateDirector(CreateDirectorViewModel viewModel) { if (ModelState.IsValid) { var directorDetailsDto = FilmViewerMapper.Mapper.Map <DirectorDetailsDto>(viewModel); var directorId = _directorService.AddDirector(directorDetailsDto, Server.MapPath(FolderPaths.UploadPath), FolderPaths.UploadPath); return(RedirectToAction("AddPhotoToDirector", new { id = directorId })); } return(View(viewModel)); }
public async Task <IHttpActionResult> PostAsync([FromBody] DirectorCompleteModelIN newDirector) { await Task.Yield(); if (newDirector == null) { return(BadRequest("Director can not be empty")); } try { directorService.AddDirector(newDirector.ToEntity()); return(Content(HttpStatusCode.Created, $"{newDirector.Name} created")); } catch (DataBaseException) { return(Content(HttpStatusCode.Accepted, $"{newDirector.Name} already exists")); } }