コード例 #1
0
        public ActionResult Create()
        {
            ManageCourierApiModel courierApiModel = new ManageCourierApiModel
            {
                CountryList = new SelectList(dropdown.BindCountry(), "Value", "Text"),
                CourierList = new SelectList(dropdown.BindCourier(CurrentUser.CompanyId), "Value", "Text")
            };

            return(View(courierApiModel));
        }
コード例 #2
0
        public ActionResult Edit(ManageCourierApiModel model)
        {
            var SessionModel = Session["User"] as SessionModel;

            using (var con = new SqlConnection(_connectionString))
            {
                var result = con.Query <int>("Add_Edit_Delete_CourierApi",
                                             new
                {
                    model.API_ID,
                    CourierID = model.Courier,
                    CountryID = model.Country,
                    model.Username,
                    model.Passwrd,
                    model.AppVersion,
                    model.AccountNo,
                    model.AccountPIN,
                    model.AccountEntity,
                    model.AccountCountryCode,
                    model.IsLargePacket,
                    model.IsActive,
                    model.Comments,
                    User = SessionModel.UserId,
                    SessionModel.CompanyId,
                    Action = "U",
                }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                var response = new ResponseModel();
                if (result == 2)
                {
                    response.IsSuccess   = true;
                    response.Response    = "Updated Successfully ";
                    TempData["response"] = response;
                }
                else
                {
                    response.IsSuccess   = true;
                    response.Response    = "Not Updated";
                    TempData["response"] = response;
                }
            }
            // return View(model);
            return(RedirectToAction("ManageCourierApi"));
        }
コード例 #3
0
 public ActionResult Create(ManageCourierApiModel model)
 {
     using (var con = new SqlConnection(_connectionString))
     {
         // ViewBag.Country = new SelectList(dropdown.BindCountry(), "Value", "Text");
         // ViewBag.Courier = new SelectList(dropdown.BindCourier(), "Value", "Text");/
         var result = con.Query <int>("Add_Edit_Delete_CourierApi",
                                      new
         {
             model.API_ID,
             CourierID = model.Courier,
             CountryID = model.Country,
             model.Username,
             model.Passwrd,
             model.AppVersion,
             model.AccountNo,
             model.AccountPIN,
             model.AccountEntity,
             model.AccountCountryCode,
             model.IsLargePacket,
             model.IsActive,
             model.Comments,
             User = CurrentUser.UserId,
             CurrentUser.CompanyId,
             Action = "I",
         }, commandType: CommandType.StoredProcedure).FirstOrDefault();
         var response = new ResponseModel();
         if (result == 1)
         {
             response.IsSuccess   = true;
             response.Response    = " Successfully Added ";
             TempData["response"] = response;
         }
         else
         {
             response.IsSuccess   = true;
             response.Response    = " Username Already Exist ";
             TempData["response"] = response;
         }
     }
     return(RedirectToAction("ManageCourierApi"));
 }