public async Task <ActionResult <CompanyCustomer> > UpdateCompany(UpdateCompanyCustomer model) { model.CorpClientId = UserData.CorpClientId.Value; var data = await service.Update(model); model.CustomerTypeId = 2; if (data != null) { return(Ok(data)); } return(new StatusCodeResult(304)); }
public async Task <CompanyCustomer> Update(UpdateCompanyCustomer model) { var entity = context.CompanyCustomers.Where(p => p.CustomerId == model.CustomerId && p.CorpClientId == model.CorpClientId).FirstOrDefault(); entity.Name = model.Name; entity.Cnpj = model.Cnpj; context.Update(entity); var rows = await context.SaveChangesAsync(); var result = mapper.Map <CompanyCustomer>(entity); return(await Task.FromResult(result)); }
public async Task <CompanyCustomer> Update(UpdateCompanyCustomer model) { return(await companyCustomerRepository.Update(model)); }