Пример #1
0
 public BaseResponse UpdateInfo(UpdateInfo info)
 {
     return Execute(_repository, r => r.UpdateInfo(info));
 }
Пример #2
0
        public BaseResponse UpdateInfo(UpdateInfo info)
        {
            var response = new BaseResponse();

            using (var db = DbContext)
            {
                var entityDb = new Entity.Artice { Id = info.Id };
                db.Artices.Attach(entityDb);

                var changed = false;

                if (info.Status.HasValue)
                {
                    entityDb.Status = info.Status.Value;
                    db.Entry(entityDb).Property(o => o.Status).IsModified = true;
                    changed = true;
                }

                if (changed)
                {
                    response.Success = db.SaveChanges() > 0;
                }
            }

            return response;
        }