Beispiel #1
0
        public Models.Comment Update(int id, Models.Comment entity)
        {
            try
            {
                entity    = CommentDataProccessor.ValidationAndProcess(entity);
                entity.Id = id;

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
        public Models.Comment Create(Models.Comment entity)
        {
            try
            {
                entity = CommentDataProccessor.ValidationAndProcess(entity);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }