示例#1
0
 public ActionResult Edit([Bind(Include = "ID,cCode,cValue,cLangID,cUpdateTime")] BaiVietHeThong baiVietHeThong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(baiVietHeThong).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(baiVietHeThong));
 }
示例#2
0
        public IHttpActionResult Consignment(Operation op)
        {
            ModelClient  model     = new ModelClient();
            Client       client    = model.Client.Where(x => x.CL_ID == op.CL_ID).FirstOrDefault();
            OperationLog operation = new OperationLog();
            Account      account   = model.Accounts.Where(x => x.AC_CL_ID == client.CL_ID).FirstOrDefault();

            try
            {
                account.AC_BALANCE         = account.AC_BALANCE + op.value;
                model.Entry(account).State = System.Data.Entity.EntityState.Modified;
                operation.OP_DESCRIPTION   = ConfigurationManager.AppSettings["MSG_CONSIGNMENT_OK"];
                operation.OP_AC_ID         = account.AC_ID;
                operation.OP_CL_ID         = client.CL_ID;
                operation.OP_DATE          = DateTime.Now;
                model.Operations.Add(operation);
                model.SaveChanges();
            }catch (Exception ex)
            {
                log.Error(ex.Message);
                operation.OP_DESCRIPTION = ConfigurationManager.AppSettings["MSG_ERROR"];
                operation.OP_AC_ID       = account.AC_ID;
                operation.OP_CL_ID       = client.CL_ID;
                operation.OP_DATE        = DateTime.Now;
                model.Operations.Add(operation);
                model.SaveChanges();
            }
            return(Ok(operation));
        }