Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            await _directorService.Create(DirectorCreation);

            return(RedirectToPage("/Index"));
        }
Exemplo n.º 2
0
        public ActionResult Create(DirectorViewModel directorViewModel, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                directorViewModel.Id = Guid.NewGuid();

                Director director = Mapper.Map <Director>(directorViewModel);
                if (image != null)
                {
                    if (CheckImageUploadExtension.CheckImagePath(image.FileName) == true)
                    {
                        var path = Path.Combine(Server.MapPath("~/Images/Upload"), image.FileName);
                        image.SaveAs(path);
                        director.Thumbnail = VariableUtils.UrlUpLoadImage + image.FileName;
                    }
                }
                _directorService.Create(director);

                return(RedirectToAction("Index"));
            }

            return(PartialView("_CreateDirector", directorViewModel));
        }
Exemplo n.º 3
0
 public async Task Create(DirectorInputDto inputDto)
 {
     await DirectorService.Create(inputDto);
 }