Exemple #1
0
        public bool UpdateHotelFileStream(HotelFileStreamCreateUpdateModel parameters)
        {
            var result = false;
            var entity = new HotelFileStreams();
            var query  = _accommodationContext.HotelFileStreams.Where(x => x.Deleted == false && x.Id == parameters.Id);

            if (query.Count() == 0)
            {
                return(result);
            }

            entity = query.FirstOrDefault();
            entity = _mapper.Map <HotelFileStreamCreateUpdateModel, HotelFileStreams>(parameters, entity);
            entity.LastModifiedBy   = UserContextHelper.UserId;
            entity.LastModifiedDate = DateTime.Now;
            var update = _accommodationContext.Update(entity);

            _accommodationContext.SaveChanges();

            if (update.State == EntityState.Unchanged)
            {
                result = true;
            }

            return(result);
        }
Exemple #2
0
        public bool CreateHotelFileStream(HotelFileStreamCreateUpdateModel parameters)
        {
            var result = false;
            var entity = new HotelFileStreams();

            entity                  = _mapper.Map <HotelFileStreams>(parameters);
            entity.Deleted          = false;
            entity.LastModifiedDate = DateTime.Now;
            entity.LastModifiedBy   = UserContextHelper.UserId;
            var add = _accommodationContext.Add(entity);

            _accommodationContext.SaveChanges();

            if (add.State == EntityState.Unchanged)
            {
                result = true;
            }

            return(result);
        }