public ActionResult Add() { // TODO: sanitize input and add AntiForgeryToken var userRepository = new UserRepository(); User user = userRepository.GetUser(this.User.Identity.Name); this.ViewData.Add("UserFound", user != null); if (user == null) { return(this.View("New")); } EnrichUserWithClaims(user); var shipment = new Shipment { Id = Guid.NewGuid(), ToAddress = this.Request.Form["ShippingToAddress"], PickupDate = DateTime.Parse(this.Request.Form["PickupDate"], CultureInfo.CurrentUICulture), ServiceType = (ShipmentServiceType)Enum.Parse(typeof(ShipmentServiceType), this.Request.Form["ServiceType"]), Details = this.Request.Form["Details"], Organization = user.Organization, Status = ShipmentStatus.NotStarted, Sender = user }; shipment.CalculateFee(); var repository = new ShipmentRepository(); repository.SaveShipment(shipment); user.PreferredShippingServiceType = shipment.ServiceType; userRepository.UpdatePreferredShippingServiceType(user); return(this.RedirectToAction("Index")); }