public IHttpActionResult EditPriceList(EditPriceListBindingModel model)
        {
            if (model == null)
            {
                return(this.BadRequest("Missing price list data to edit"));
            }

            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var escortId = this.User.Identity.GetUserId();
            var escort   = this.EscortServiceData.Escorts
                           .FirstOrDefault(e => !e.IsDeleted && e.Id == escortId);

            if (escort == null)
            {
                return(this.Content(HttpStatusCode.BadRequest,
                                    string.Format("There is no existing active escort with Id: {0}", escortId)));
            }

            var priceList = this.EscortServiceData.PriceLists
                            .FirstOrDefault(p => p.EscortId == escort.Id);

            if (priceList == null)
            {
                return(this.NotFound());
            }

            if (model.ThirtyMinuteRate != null)
            {
                priceList.ThirtyMinuteRate = model.ThirtyMinuteRate;
            }

            if (model.HourRate != null)
            {
                priceList.HourRate = model.HourRate;
            }

            if (model.ThreeHoursRate != null)
            {
                priceList.ThreeHoursRate = model.ThreeHoursRate;
            }

            if (model.SixHoursRate != null)
            {
                priceList.SixHoursRate = model.SixHoursRate;
            }

            if (model.OvernightRate != null)
            {
                priceList.OvernightRate = model.OvernightRate;
            }

            if (model.DailyRate != null)
            {
                priceList.DailyRate = model.DailyRate;
            }

            if (model.WeekendRate != null)
            {
                priceList.WeekendRate = model.WeekendRate;
            }

            if (model.WeeklyRate != null)
            {
                priceList.WeeklyRate = model.WeeklyRate;
            }

            this.EscortServiceData.PriceLists.AddOrUpdate(priceList);
            this.EscortServiceData.SaveChanges();

            return(this.Ok(new
            {
                Message = "Escort with id: " + escortId + "  patched."
            }));
        }
        public IHttpActionResult EditPriceList(EditPriceListBindingModel model)
        {
            if (model == null)
            {
                return this.BadRequest("Missing price list data to edit");
            }

            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var escortId = this.User.Identity.GetUserId();
            var escort = this.EscortServiceData.Escorts
                .FirstOrDefault(e => !e.IsDeleted && e.Id == escortId);

            if (escort == null)
            {
                return this.Content(HttpStatusCode.BadRequest,
                    string.Format("There is no existing active escort with Id: {0}", escortId));
            }

            var priceList = this.EscortServiceData.PriceLists
                .FirstOrDefault(p => p.EscortId == escort.Id);

            if (priceList == null)
            {
                return this.NotFound();
            }

            if (model.ThirtyMinuteRate != null)
            {
                priceList.ThirtyMinuteRate = model.ThirtyMinuteRate;
            }

            if (model.HourRate != null)
            {
                priceList.HourRate = model.HourRate;
            }

            if (model.ThreeHoursRate != null)
            {
                priceList.ThreeHoursRate = model.ThreeHoursRate;
            }

            if (model.SixHoursRate != null)
            {
                priceList.SixHoursRate = model.SixHoursRate;
            }

            if (model.OvernightRate != null)
            {
                priceList.OvernightRate = model.OvernightRate;
            }

            if (model.DailyRate != null)
            {
                priceList.DailyRate = model.DailyRate;
            }

            if (model.WeekendRate != null)
            {
                priceList.WeekendRate = model.WeekendRate;
            }

            if (model.WeeklyRate != null)
            {
                priceList.WeeklyRate = model.WeeklyRate;
            }

            this.EscortServiceData.PriceLists.AddOrUpdate(priceList);
            this.EscortServiceData.SaveChanges();

            return this.Ok(new
            {
                Message = "Escort with id: " + escortId + "  patched."
            });
        }