Beispiel #1
0
        public JsonResult GetShipper(DTParameters param)
        {
            ShipperViewStore shipper = new ShipperViewStore();

            shipper.PageIndex = param.Start / param.Length + 1;
            shipper.PageSize  = param.Length;
            if (param.Search.Value == null)
            {
                shipper.Search = "%%";
            }
            else
            {
                shipper.Search = "%" + param.Search.Value + "%";
            }
            shipper.Order = param.SortOrder;
            ShipperViewStore categories = new ShipperModels().GetShipperByPage(shipper.Search, shipper.Order, shipper.PageIndex, shipper.PageSize);

            DTResult <ShipperDTO> final = new DTResult <ShipperDTO>()
            {
                draw            = param.Draw,
                data            = categories.Shippers.ToList(),
                recordsFiltered = categories.RecordCount,
                recordsTotal    = categories.Shippers.Count
            };

            return(Json(final));
        }
Beispiel #2
0
        public JsonResult GetShipperByID(int id)
        {
            ShipperDTO shipper = new ShipperModels().GetShipperById(id);

            return(Json(new
            {
                shipper.ShipperID,
                shipper.CompanyName,
                shipper.Phone
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult Delete(int id)
        {
            bool check = new ShipperModels().DeleteShipper(id);

            if (check)
            {
                return(Json(new { Ok = true }));
            }
            else
            {
                return(Json(new { Ok = false }));
            }
        }
Beispiel #4
0
        public ActionResult Update()
        {
            int        cateId  = int.Parse(Request.Form["ShipperID"]);
            ShipperDTO shipper = new ShipperModels().GetShipperById(cateId);

            shipper.CompanyName = Request.Params["CompanyName"];
            shipper.Phone       = Request.Params["Phone"];

            bool check = new ShipperModels().PutShipper(shipper);

            if (check)
            {
                return(Json(new { Ok = true }));
            }
            else
            {
                return(Json(new { Ok = false }));
            }
        }
Beispiel #5
0
        public ActionResult Insert()
        {
            //HttpPostedFileBase file = Request.Files[0];
            ShipperDTO shipper = new ShipperDTO();

            //shipper.ShipperID = int.Parse(Request.Params["ShipperID"]);
            shipper.CompanyName = Request.Params["CompanyName"];
            shipper.Phone       = Request.Params["Phone"];

            bool check = new ShipperModels().PostNewShipper(shipper);

            if (check)
            {
                return(Json(new { Ok = true }));
            }
            else
            {
                return(Json(new { Ok = false }));
            }
        }