public ActionConfirmation SaveOrUpdate(WrmsSystem wrmsSystem) { if (wrmsSystem.IsValid()) { ValidateWrmsSystem(wrmsSystem); _wrmsSystemRepository.SaveOrUpdate(wrmsSystem); ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation( "The wrmsSystem was successfully saved."); saveOrUpdateConfirmation.Value = wrmsSystem; return(saveOrUpdateConfirmation); } else { _wrmsSystemRepository.DbContext.RollbackTransaction(); return(ActionConfirmation.CreateFailureConfirmation( "The wrmsSystem could not be saved due to missing or invalid information.")); } }
public ActionConfirmation UpdateWith(WrmsSystem wrmsSystemFromForm, int idOfWrmsSystemToUpdate) { WrmsSystem wrmsSystemToUpdate = _wrmsSystemRepository.Get(idOfWrmsSystemToUpdate); ValidateWrmsSystem(wrmsSystemFromForm); TransferFormValuesTo(wrmsSystemToUpdate, wrmsSystemFromForm); if (wrmsSystemToUpdate.IsValid()) { ActionConfirmation updateConfirmation = ActionConfirmation.CreateSuccessConfirmation( "The wrmsSystem was successfully updated."); updateConfirmation.Value = wrmsSystemToUpdate; return(updateConfirmation); } else { _wrmsSystemRepository.DbContext.RollbackTransaction(); return(ActionConfirmation.CreateFailureConfirmation( "The wrmsSystem could not be saved due to missing or invalid information.")); } }