Exemplo n.º 1
0
        public Guid UpdateByUser(Models.SenUserView data)
        {
            try
            {
                if (data.UserId == Guid.Empty)
                {
                    data.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                }
                this.Validate(data);

                if (this.IsExist(data.UserId))
                {
                    var _data = this.GetById2(data.UserId);
                    this.MapView2Table(data, _data);

                    this._db.Entry(data).State = System.Data.Entity.EntityState.Modified;
                    this._db.SaveChanges();
                    return(data.UserId);
                }
                else
                {
                    return(this.InsertByUser(data));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public Models.SenUserView GetEdit(Guid id)
        {
            var model = GetById(id);

            if (model == null)
            {
                model = new Models.SenUserView();
            }

            return(model);
        }
Exemplo n.º 3
0
 public ActionResult Edit(int SenUserId, Models.SenUserView collection)
 {
     try
     {
         int outputId = _dataobject.Update(collection);
         return(RedirectToAction(this.ActionReturn()));
     }
     catch (Exception ex)
     {
         Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
         return(PartialView(this._updateview, collection));
     }
 }
Exemplo n.º 4
0
 public int Insert(Models.SenUserView data)
 {
     try
     {
         this.Validate(data);
         var _data = new Models.SenUser();
         this.MapView2Table(data, _data);
         this._db.SenUsers.Add(_data);
         this._db.SaveChanges();
         return(data.SenUserId);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 5
0
        public Guid InsertByUser(Models.SenUserView data)
        {
            try
            {
                this.Validate(data);
                data.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());

                var _data = new Models.SenUser();
                this.MapView2Table(data, _data);

                this._db.SenUsers.Add(_data);
                this._db.SaveChanges();
                return(data.UserId);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public int Update(Models.SenUserView data)
        {
            try
            {
                this.Validate(data);

                var _data = this.GetById2(data.SenUserId);
                this.MapView2Table(data, _data);

                this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified;
                this._db.SaveChanges();

                return(data.SenUserId);
            }
            catch (Exception)
            {
                throw;
            }
        }