Example #1
0
        public int Insert(Models.SenUserPaymentView data)
        {
            try
            {
                this.Validate(data);
                data.CreateBy   = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                data.CreateDate = DateTime.UtcNow;

                var _data = new Models.SenUserPayment();
                this.MapView2Table(data, _data);
                this._db.SenUserPayments.Add(_data);
                this._db.SaveChanges();

                var senuserpay        = this.GetById(_data.UserPaymentId);
                var senuserdataobject = new DAL.SenUser(this._request);
                senuserdataobject.UpdateCash(senuserpay.UserId ?? Guid.Empty);

                this.SenUserTransactionPost(_data.UserPaymentId);

                this.SetExpireDate(data.CompanyId, data.Quantity);

                return(_data.UserPaymentId);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public int Update(Models.SenUserPaymentView data)
        {
            try
            {
                this.Validate(data);
                var _data = this.GetById2(data.UserPaymentId);

                data.CreateDate = _data.CreateDate;
                data.CreateBy   = _data.CreateBy;

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

                var senuserdataobject = new DAL.SenUser(this._request);
                senuserdataobject.UpdateCash(data.UserId ?? Guid.Empty);

                this.SenUserTransactionPost(data.UserPaymentId);
                return(data.UserPaymentId);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
 public ActionResult Edit(int UserPaymentId, Models.SenUserPaymentView 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));
     }
 }