public IActionResult Create(CT_GIOHANG item) { string a = DateTime.Now.ToString("yyyyMMddhh:mm:ss"); string f*g = a.Replace(" ", ""); string b = a.Replace("/", ""); string c = b.Replace(":", ""); long kq = long.Parse(c); item.ID_CTGH = kq + item.IDSP; _context.ChiTiets.Add(item); _context.SaveChanges(); return(CreatedAtRoute("Get", new { id = item.IDGH }, item)); }
public IActionResult Update(long id, CT_GIOHANG item) { var todo = _context.ChiTiets.Find(id); if (todo == null) { return(NotFound()); } todo.IDGH = item.IDGH; todo.IDSP = item.IDSP; todo.SOLUONGBAN = item.SOLUONGBAN; _context.ChiTiets.Update(todo); _context.SaveChanges(); return(NoContent()); }