public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Code,MinimunRange,MaximunRange,Active,Created,Modified")] MaterialTypeCost materialTypeCost) { if (id != materialTypeCost.Id) { return(NotFound()); } if (ModelState.IsValid) { try { materialTypeCost.Modified = DateTime.Now; materialTypeCost.ModifiedBy = UserLogged; _context.Update(materialTypeCost); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaterialTypeExists(materialTypeCost.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(materialTypeCost)); }
public async Task <IActionResult> Create([Bind("Id,Description,Code,MinimunRange,MaximunRange,Active,Created,Modified")] MaterialTypeCost materialTypeCost) { if (ModelState.IsValid) { materialTypeCost.Active = true; materialTypeCost.Created = DateTime.Now; materialTypeCost.CreatedBy = UserLogged; materialTypeCost.Modified = DateTime.Now; materialTypeCost.ModifiedBy = UserLogged; _context.Add(materialTypeCost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(materialTypeCost)); }