Esempio n. 1
0
        public Models.Review Create(Models.Review entity)
        {
            try
            {
                entity = NewsDataProccessor.ValidationAndProcess(entity);

                DbEntities.Reviews.AddObject(entity);
                DbEntities.SaveChanges();
                DbEntities.Refresh(System.Data.Objects.RefreshMode.StoreWins, entity);

                return(Read(entity.Id));
            }
            catch
            {
                throw;
            }
        }
Esempio n. 2
0
        public Models.Review Update(int id, Models.Review entity)
        {
            try
            {
                entity    = NewsDataProccessor.ValidationAndProcess(entity);
                entity.Id = id;

                string oldRatedAspects = entity.RatedAspects;

                DbEntities.ApplyCurrentValues("Reviews", entity);
                DbEntities.SaveChanges();

                return(Read(entity.Id));
            }
            catch
            {
                throw;
            }
        }