예제 #1
0
        public ActionResult TRANS_LOGISTIC_Create([DataSourceRequest] DataSourceRequest request, TRANS_LOGISTIC tRANS_LOGISTIC)
        {
            if (ModelState.IsValid)
            {
                var entity = new TRANS_LOGISTIC
                {
                    tran_name     = tRANS_LOGISTIC.tran_name,
                    tran_phone    = tRANS_LOGISTIC.tran_phone,
                    tran_user     = tRANS_LOGISTIC.tran_user,
                    tran_password = tRANS_LOGISTIC.tran_password
                };

                db.TRANS_LOGISTIC.Add(entity);
                db.SaveChanges();
                tRANS_LOGISTIC.tran_id = entity.tran_id;
            }

            return(Json(new[] { tRANS_LOGISTIC }.ToDataSourceResult(request, ModelState)));
        }
예제 #2
0
        public ActionResult TRANS_LOGISTIC_Update([DataSourceRequest] DataSourceRequest request, TRANS_LOGISTIC tRANS_LOGISTIC)
        {
            if (ModelState.IsValid)
            {
                var entity = new TRANS_LOGISTIC
                {
                    tran_id       = tRANS_LOGISTIC.tran_id,
                    tran_name     = tRANS_LOGISTIC.tran_name,
                    tran_phone    = tRANS_LOGISTIC.tran_phone,
                    tran_user     = tRANS_LOGISTIC.tran_user,
                    tran_password = tRANS_LOGISTIC.tran_password
                };

                db.TRANS_LOGISTIC.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { tRANS_LOGISTIC }.ToDataSourceResult(request, ModelState)));
        }