コード例 #1
0
 public IActionResult Create(FagViewModel f*g)
 {
     if (ModelState.IsValid)
     {
         F*g model = _mapper.Map <FagViewModel, F*g>(f*g);
         model.CreatedBy = _admin.FullName;
         _fagRepository.CreateFag(model);
         return(RedirectToAction("index"));
     }
     return(View(f*g));
 }
コード例 #2
0
 public IActionResult Edit(FagViewModel f*g)
 {
     if (ModelState.IsValid)
     {
         F*g model = _mapper.Map <FagViewModel, F*g>(f*g);
         model.ModifiedBy = _admin.FullName;
         F*g fagToUpdate = _fagRepository.GetFagById(f*g.Id);
         if (fagToUpdate == null)
         {
             return(NotFound());
         }
         _fagRepository.UpdateFag(fagToUpdate, model);
         return(RedirectToAction("index"));
     }
     return(View(f*g));
 }