예제 #1
0
 public static void UpdateTacGia(this TacGia tacGia, TacGiaViewModel tacGiaViewModel)
 {
     tacGia.ID          = tacGiaViewModel.ID;
     tacGia.Name        = tacGiaViewModel.Name;
     tacGia.Image       = tacGiaViewModel.Image;
     tacGia.Description = tacGiaViewModel.Description;
     tacGia.CreateDate  = tacGiaViewModel.CreateDate;
     tacGia.CreateBy    = tacGiaViewModel.CreateBy;
     tacGia.UpdateDate  = tacGiaViewModel.UpdateDate;
     tacGia.UpdateBy    = tacGiaViewModel.UpdateBy;
     tacGia.Status      = tacGiaViewModel.Status;
 }
예제 #2
0
 public ActionResult Add(TacGiaViewModel model)
 {
     if (ModelState.IsValid)
     {
         model.CreateDate = DateTime.Now;
         TacGia tacGia = new TacGia();
         tacGia.UpdateTacGia(model);
         _tacGiaService.Add(tacGia);
         _context.SaveChanges();
         ViewData["successMsg"] = "Thêm thành công";
     }
     return(View());
 }