public async Task <EntityActionOutcome> UpdateEntityAsync(WebsiteInputData viewData, Guid id) { var getCurrent = await _repository.GetByIdAsync <Website>(id); var validator = new WebsiteInputDataValidator(); var result = validator.Validate(viewData); if (result.IsValid == false) { return(EntityActionOutcome.UpdateFailed); } var updateSuccessful = _repository.Update(await PopulateEntityDataWithViewData(viewData, id)); if (updateSuccessful == null) { return(EntityActionOutcome.EntityNotFound); } return(EntityActionOutcome.Success); }
public IActionResult Update(Website item) { if (!ModelState.IsValid) { return(View("Edit", item.ID)); } if (item.Username == null) { item.Username = ""; } if (item.URL == null) { item.URL = ""; } if (item.PasswordValue == null) { item.PasswordValue = ""; } website_repo.Update(item); return(RedirectToAction("Index", "Vault")); }