Exemplo n.º 1
0
 public ActionResult Create(DmcauHinh model)
 {
     try
     {
         model.Id = Guid.NewGuid();
         if (String.IsNullOrEmpty(model.Mota))
         {
             model.Mota = "Cpu: " + model.Cpu + "Ram: " + model.Ram + "Pin: " + model.Pin + "Màn hình: " + model.ManHinh;
         }
         _context.DmcauHinh.Add(model);
         _context.SaveChanges();
         return(NoContent());
     }
     catch (Exception)
     {
         throw new Exception("Mã code đã tồn tại");
     }
 }
Exemplo n.º 2
0
 public ActionResult Update(DmcauHinh model)
 {
     _context.Entry(model).State = EntityState.Modified;
     _context.SaveChanges();
     return(NoContent());
 }