//About Creat//
 public IActionResult Create(AboutModel model)
 {
     if (model == null)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         var about = _mapper.Map <AboutModel, AboutUs>(model);
         about.AddedBy   = _admin.Name;
         about.AddedDate = DateTime.Now;
         if (model.File != null)
         {
             about.Image = _fileManager.Upload(model.File);
         }
         else
         {
             about.Image = null;
         }
         _aboutRepository.AddAbout(about);
         return(RedirectToAction("index"));
     }
     return(View(model));
 }
예제 #2
0
 public async Task <About> AddAbout(About about)
 {
     about.CreatedAt = DateTime.UtcNow;
     return(await _aboutRepository.AddAbout(about));
 }