Пример #1
0
        public static EFResponse Update(User param)
        {
            EFResponse model = new EFResponse();

            try
            {
                db.Entry(param).State = EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception e)
            {
                model.ErrorEntity = e.InnerException != null?e.InnerException.ToString() : e.Message;

                model.ErrorMessage = e.Message;
                model.Success      = false;
            }

            return(model);
        }
Пример #2
0
        public static EFResponse Insert(User param)
        {
            EFResponse model = new EFResponse();

            try
            {
                param.IsDeleted   = false;
                param.Createddate = DateTime.Now;
                db.Users.Add(param);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                model.ErrorEntity = e.InnerException != null?e.InnerException.ToString() : e.Message;

                model.ErrorMessage = e.Message;
                model.Success      = false;
            }

            return(model);
        }