Esempio n. 1
0
 public ActionResult Edit(int Id, Models.SenGiftCard 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));
     }
 }
Esempio n. 2
0
        public int InsertGiftCard(Models.SenGiftCard giftcard)
        {
            var cash = this.GetNew(null);

            Guid userid = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());

            cash.Amount      = giftcard.Amount;
            cash.CashType    = 1;
            cash.Description = string.Format("Khuyến mại: {0}", giftcard.GiftCardCouponCode);
            cash.UserId      = userid;
            cash.UserName    = Membership.GetUser().UserName;

            return(this.Insert(cash));
        }
Esempio n. 3
0
        public int Insert(Models.SenGiftCard data)
        {
            try
            {
                this.Validate(data);

                this._db.SenGiftCards.Add(data);
                this._db.SaveChanges();
                return(data.Id);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        public int Update(Models.SenGiftCard data)
        {
            try
            {
                this.Validate(data);

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

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