public async Task <IActionResult> Create([Bind("Id,About,Title,Desc,Button,Upload")] MostPartner mostPartner)
        {
            if (mostPartner.Upload == null)
            {
                ModelState.AddModelError("Upload", "Sekil Mecburidir");
            }
            if (ModelState.IsValid)
            {
                var fileName = _fileManager.Upload(mostPartner.Upload);
                mostPartner.Photo = fileName;
                _context.Add(mostPartner);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(mostPartner));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Text,Upload")] BusinesSolution businesSolution)
        {
            if (businesSolution.Upload == null)
            {
                ModelState.AddModelError("Upload", "Sekil Mecburidir");
            }
            if (ModelState.IsValid)
            {
                var fileName = _fileManager.Upload(businesSolution.Upload);
                businesSolution.Photo = fileName;
                _context.Add(businesSolution);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(businesSolution));
        }