Example #1
0
        public ResponseMessageResult Putfa_merchant_bank_card(fa_merchant_bank_card fa_merchant_bank_card)
        {
            JwtModel jwtmodel = JwtHelper.getToken(HttpContext.Current.Request.Headers.GetValues("Authorization").First().ToString());

            if (jwtmodel.isadmin)
            {
                db.Entry(fa_merchant_bank_card).State = EntityState.Modified;
                try
                {
                    model.message     = "修改成功";
                    model.status_code = 200;
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    model.message     = ex.Message;
                    model.status_code = 401;
                }
            }
            else
            {
                model.message     = "用户权限不足";
                model.status_code = 401;
            }
            return(new ResponseMessageResult(Request.CreateResponse((HttpStatusCode)model.status_code, model)));
        }
Example #2
0
        public ResponseMessageResult Postfa_merchant_bank_card(fa_merchant_bank_card fa_merchant_bank_card)
        {
            JwtModel jwtmodel = JwtHelper.getToken(HttpContext.Current.Request.Headers.GetValues("Authorization").First().ToString());

            if (jwtmodel.isadmin)
            {
                fa_merchant_bank_card.addtime = DateTime.Now;
                fa_merchant_bank_card.adduser = jwtmodel.username;
                db.fa_merchant_bank_card.Add(fa_merchant_bank_card);
                try
                {
                    db.SaveChanges();
                    model.message     = "新增成功";
                    model.status_code = 200;
                }
                catch (Exception ex)
                {
                    model.message     = ex.Message;
                    model.status_code = 401;
                }
            }
            else
            {
                model.message     = "用户权限不足";
                model.status_code = 401;
            }
            return(new ResponseMessageResult(Request.CreateResponse((HttpStatusCode)model.status_code, model)));
        }
Example #3
0
        public ResponseMessageResult Deletefa_merchant_bank_card(int id)
        {
            fa_merchant_bank_card fa_merchant_bank_card = db.fa_merchant_bank_card.Find(id);

            if (fa_merchant_bank_card == null)
            {
                model.message     = "删除失败";
                model.status_code = 401;
            }

            db.fa_merchant_bank_card.Remove(fa_merchant_bank_card);
            db.SaveChanges();
            model.message     = "删除成功";
            model.status_code = 200;
            return(new ResponseMessageResult(Request.CreateResponse((HttpStatusCode)model.status_code, model)));
        }