public IHttpActionResult ModifyAccount(NordCar.WebAPI.Models.EC.PersonalAccount input) { //CustomerNo on PersonalAccount is not used and should be removed, however remember it is used on response. var content = JsonConvert.SerializeObject(input); Log.LogDebug(new Carla.Shared.Logging.LoggingMessage.LogMessage("ModifyAccount", content)); var bs1 = fillbasics(input.basic); var bs = Mapper.Map <BasicStructure, NordCar.Carla.Data.Entities.BasicStructure>(bs1); var input1 = Mapper.Map <NordCar.WebAPI.Models.EC.Person, NordCar.Carla.Data.Entities.EC.Person>(input.person); var data = this.ECAPIManagerRepository.ModifyAccount(bs, input1); if (data.Item1.Succes) { var result = new { CustomerAccount = Mapper.Map <NordCar.Carla.Data.Entities.EC.Account, NordCar.WebAPI.Models.EC.Account>(data.Item2), Status = "OK" }; return(Ok(result)); } else { return(Error(Mapper.Map <NordCar.Carla.Data.Entities.APIMethodControl, APIMethodControl>(data.Item1), HttpStatusCode.NotFound)); } }
public IHttpActionResult CreateAccount(NordCar.WebAPI.Models.EC.PersonalAccount input) { var content = JsonConvert.SerializeObject(input); Log.LogDebug(new Carla.Shared.Logging.LoggingMessage.LogMessage("CreateAccount", content)); //Adding default program if (input.person.FrequentTravelerProgram == null) { input.person.FrequentTravelerProgram = new Models.EC.FrequentTravelerProgram() { Id = "0", CardNumber = "", ExpiryDate = "" }; } var bs1 = fillbasics(input.basic); var bs = Mapper.Map <BasicStructure, NordCar.Carla.Data.Entities.BasicStructure>(bs1); var input1 = Mapper.Map <NordCar.WebAPI.Models.EC.Person, NordCar.Carla.Data.Entities.EC.Person>(input.person); var data = this.ECAPIManagerRepository.CreateAccount(bs, input1); if (data.Item1.Succes) { var result = new { CustomerAccount = Mapper.Map <NordCar.Carla.Data.Entities.EC.Account, NordCar.WebAPI.Models.EC.Account>(data.Item2), Status = "OK" }; return(Ok(result)); } else { return(Error(Mapper.Map <NordCar.Carla.Data.Entities.APIMethodControl, APIMethodControl>(data.Item1), HttpStatusCode.NotFound)); } }