public void SaveContactInformation(string cartId, PersonalInformationRequest request) { var cart = GetCart(cartId); cart.PersonalInformation = new ContactInformation { Email = request.Email, Phone = request.Phone }; Db.StringSet(cartId, JsonConvert.SerializeObject(cart)); }
public PersonalInformationResponce GetPersonalInformation(PersonalInformationRequest request) { //request.Id = 1; var responce = new PersonalInformationResponce(); responce.Persons = new List <PersonDto>() { new PersonDto { Id = request.Id, Name = "Sergii", Surname = "Safatiuk", Gender = GenderDto.Male } }; return(responce); }
public IHttpActionResult Post(PersonalInformationRequest request) { var token = Request.Headers.GetValues("Token").FirstOrDefault(); if (token == null || token.Contains("/") == false) { return(BadRequest()); } var cartId = token.Split('/')[1]; CartService.SaveContactInformation(cartId, request); var url = string.Format("http://{0}/personalinformation", HttpContext.Current.Request.Url.Authority); var cart = CartService.GetCart(cartId); var shippingAddressResponse = ToPersonalInformationResponse(cart); return(Created(url, shippingAddressResponse)); }