예제 #1
0
        public JsonResult Delete(int id)
        {
            try
            {
                if (id == 0)
                {
                    return(Json(new { responseCode = "-10" }));
                }


                DrivingCategories model = this._drivingCategoriesBusiness.Get(id);
                model.Enable = false;
                this._drivingCategoriesBusiness.Save(model);

                var responseObject = new
                {
                    responseCode = 0
                };
                return(Json(responseObject));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
예제 #2
0
        private void Update(DrivingCategories view)
        {
            DrivingCategories model = Get(view.Id);

            model.Code = view.Code;

            this.repository.Update(view);
        }
예제 #3
0
 public void Save(DrivingCategories model)
 {
     if (model.Id > 0)
     {
         Update(model);
     }
     else
     {
         Create(model);
     }
 }
예제 #4
0
        public JsonResult Get(int id)
        {
            DrivingCategories model = new DrivingCategories();

            try
            {
                model = this._drivingCategoriesBusiness.Get(id);


                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
예제 #5
0
        public JsonResult Edit(DrivingCategories model)
        {
            try
            {
                if (model == null)
                {
                    return(Json(new { responseCode = "-10" }));
                }

                this._drivingCategoriesBusiness.Save(model);

                var responseObject = new
                {
                    responseCode = 0
                };

                return(Json(responseObject));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
예제 #6
0
 private void Create(DrivingCategories view)
 {
     view.Enable = true;
     this.repository.Insert(view);
 }