public IActionResult Upsert(Attribute attribute) { if (ModelState.IsValid) { if (attribute.ATTR_ID == Guid.Empty) { _unitOfWork.Attribute.Add(attribute); } else { _unitOfWork.Attribute.Update(attribute); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(attribute)); }
public IActionResult Upsert(Guid id) { var attribute = new Attribute(); if (id == Guid.Empty) { //this is for create return(View(attribute)); } // this is for edit attribute = _unitOfWork.Attribute.Get(id); if (attribute == null) { return(NotFound()); } return(View(attribute)); }