Exemplo n.º 1
0
        /// <summary>
        /// Edit restaurant and address
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(int id, RestaurantViewModel model)
        {
            var list = new List <Address>();

            list.Add(new Address()
            {
                Street     = model.Street,
                City       = model.City,
                Country    = model.Country,
                PostalCode = model.PostalCode,
                Id         = model.AddressId
            });
            var restaurant = new Restaurant()
            {
                Description = model.Description,
                Name        = model.Name,
                Type        = model.Type,
                Addresses   = list
            };

            return(restaurantRepo.Edit(id, restaurant));
        }