Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Title,Description,InitialImage,HoverImage")] Employee employee, IEnumerable <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    await _storage.UploadImages(files, employee, null, null);

                    await _context.CreateAsync(employee);

                    return(PartialView("~/Views/Shared/_CreateSuccessful.cshtml"));
                }
                catch (Exception e)
                {
                    await _emailSender.SendEmail(_messageBuilder.BuildErrorMessage(e));

                    return(PartialView("~/Views/Shared/_CreateFailed.cshtml"));
                }
            }
            return(PartialView("~/Views/Shared/_CreateFailed.cshtml"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,Name,Description,URL,Logo")] Partner partner, IEnumerable <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    await _storage.UploadImages(files, null, partner);

                    await _context.CreateAsync(partner);

                    return(PartialView("~/Views/Shared/_CreateSuccessful.cshtml"));
                }
                catch (Exception e)
                {
                    await _emailSender.SendEmail(_messageBuilder.BuildErrorMessage(e));

                    return(PartialView("~/Views/Shared/_CreateFailed.cshtml"));
                }
            }
            return(PartialView("~/Views/Shared/_CreateFailed.cshtml"));
        }