public CarrierBO AddBroker(CarrierBO carrier) { carrier _carrier = new carrier(); _carrier.carriername = carrier.CarrierName; if (carrier.Address != null) { _carrier.addrkey = carrier.Address.AddrKey; } _carrier.carrierid = carrier.CarrierId; var carrierguid = repo.Add(_carrier); carrier.CarrierKey = carrierguid; return(carrier); }
public void Test_Add_Get() { var data = _fixture.Create <CarrierData>(); data.Language = TwoLetterISOLanguageName.English; var password = _fixture.Create <string>(); var id = _repository.Add(data.Name, data.Email, data.Phone, data.Contact, data.Address, data.Login, password, data.Language); var actual = _repository.Get(id); actual.ShouldBeEquivalentTo(data, options => options.Excluding(x => x.Id).Excluding(x => x.UserId)); actual.Id.ShouldBeEquivalentTo(id); actual.UserId.Should().NotBe(0); }
public async Task <ActionResult> Create([Bind(Include = "Id,Tipo,CpfCnpj,NomeRazao,RgIe,Endereco,Numero,Bairro,Complemento,CEP,Cidade,UF,Contato,Telefone,Celular,Email,Site,Ativa,cClassificacao")] CarrierViewModel carrierViewModel) { if (ModelState.IsValid) { var mapper = Mapper.CreateMap <Carrier, CarrierViewModel>(); var carrier = Mapper.Map <Carrier>(carrierViewModel); repository.Add(carrier); var routeValue = new RouteValueDictionary(); routeValue.Add("page", "1"); return(RedirectToAction("Index", routeValue)); } return(View(carrierViewModel)); }