public virtual async Task UpdateInquiryAsync(NewCustomerTypeInputDto input) { var query = await _newCustomerTypeRepository.GetAsync(input.Id); ObjectMapper.Map(input, query); await _newCustomerTypeRepository.UpdateAsync(query); }
public async Task CreateOrUpdateNewCustomerType(NewCustomerTypeInputDto input) { if (input.Id != 0) { await UpdateInquiryAsync(input); } else { await CreateInquiryAsync(input); } }
public virtual async Task CreateInquiryAsync(NewCustomerTypeInputDto input) { var query = input.MapTo <NewCustomerType>(); try { await _newCustomerTypeRepository.InsertAsync(query); } catch (Exception ex) { string str = ex.Message.ToString(); } }
public virtual async Task UpdateCustomerTypeAsync(NewCustomerTypeInputDto input) { using (_unitOfWorkManager.Current.SetTenantId(AbpSession.TenantId)) { input.TenantId = (int)(AbpSession.TenantId); var query = await _newCustomerTypeRepository.GetAsync(input.Id); ObjectMapper.Map(input, query); var val = _newCustomerTypeRepository .GetAll().Where(p => p.Title == input.Title && p.Id != input.Id).FirstOrDefault(); if (val == null) { await _newCustomerTypeRepository.UpdateAsync(query); } else { throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in CustomerType '" + input.Title + "'..."); } } }