Example #1
0
        public async Task <IActionResult> collect(collectAmountViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.finalamt < model.amount)
                {
                    ModelState.AddModelError("ModelOnly", "Please Collect Proper Amount");
                    return(View(model));
                }
                else
                {
                    ApplicationUser usr = await GetCurrentUserAsync();

                    var user = await _usermanager.FindByIdAsync(usr.Id);


                    var paramter = new DynamicParameters();
                    paramter.Add("@deliveryboyid", model.deliveryboyid);
                    paramter.Add("@amount", model.amount);
                    paramter.Add("@managerId", user.Id);

                    _ISP_Call.Execute("insertdeliveryboyamt", paramter);

                    TempData["success"] = "Amount Updated successfully";
                    return(RedirectToAction(nameof(Index)));
                }
            }
            else
            {
                return(View(model));
            }

            //  return View(model);
        }
Example #2
0
        public async Task <IActionResult> collect(int id, string name, decimal amount)
        {
            var model = new collectAmountViewModel
            {
                deliveryboyid = id
                ,
                deliveryboyname = name
                ,
                amount = 0
                ,
                finalamt = amount
                ,
                remaining = amount
            };

            return(View(model));
        }