public void Update(DecisionViewModel model) { var contractType = AutoMapper.Mapper.Map <DecisionViewModel, Decision>(model); if (string.IsNullOrEmpty(contractType.Document)) { var old = _repository.FindById(model.Id); if (old != null) { contractType.Document = old.Document; } } _repository.Update(contractType); }
public (bool condition, string message, MinutzDecision value) UpdateMinutzDecision (string referenceId, MinutzDecision decision, AuthRestModel user) { if (string.IsNullOrEmpty(referenceId)) { throw new ArgumentNullException(nameof(referenceId), "Please provide a valid reference id."); } var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password); var result = _decisionRepository.Update(decision, user.InstanceId, instanceConnectionString); return(result, result ? "Success" : "Failed", decision); }