Example #1
0
        public static Data.resturant_info LibraryToData(resturant_info libModel)
        {
            var dataModel = new Data.resturant_info()
            {
                rest_ID          = libModel.rest_ID,
                rest_name        = libModel.rest_name,
                rest_address     = libModel.rest_address,
                rest_zipcode     = libModel.rest_zipcode,
                rest_phoneNumber = libModel.rest_phoneNumber,
                city             = libModel.city,
                state            = libModel.state,
                rest_rating      = libModel.rest_rating
            };

            return(dataModel);
        }
Example #2
0
        //MAPPING
        public static resturant_info DataToLibrary(Data.resturant_info dataModel)
        {
            var libModel = new resturant_info()
            {
                rest_ID          = dataModel.rest_ID,
                rest_name        = dataModel.rest_name,
                rest_address     = dataModel.rest_address,
                rest_zipcode     = dataModel.rest_zipcode,
                rest_phoneNumber = dataModel.rest_phoneNumber,
                city             = dataModel.city,
                state            = dataModel.state,
                rest_rating      = dataModel.rest_rating
            };

            return(libModel);
        }
Example #3
0
        //NEED TO IMPLEMENT SOMETHING TO WORK WITH REVIEWS

        //ADDING NEW RESTURANT
        public resturant_info AddResturant(resturant_info item)
        {
            try
            {
                using (var db = new ResturantsEntities())
                {
                    db.resturant_info.Add(LibraryToData(item));
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                LogError(e.ToString());
            }

            return(item);
        }