示例#1
0
        public async Task <IActionResult> collect(string mgrId, decimal amount)
        {
            var users = await _usermanager.FindByIdAsync(mgrId);

            var model = new adminCollectionViewModel
            {
                managerid = mgrId
                ,
                managername = users.name
                ,
                amount = 0
                ,
                finalamt = amount
                ,
                remaining = amount
            };

            return(View(model));
        }
示例#2
0
        public async Task <IActionResult> collect(adminCollectionViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.finalamt < model.amount)
                {
                    ModelState.AddModelError("ModelOnly", "Please Collect Proper Amount");
                    return(View(model));
                }
                else
                {
                    //var objcountry = new AdminCollection
                    //{

                    //    id = 0,
                    //    collectManagerId = model.managerid,
                    //    amount = model.amount,
                    //    date1 = DateTime.Now,
                    //    isdeleted = false
                    //};
                    var paramter = new DynamicParameters();

                    paramter.Add("@amount", model.amount);
                    paramter.Add("@managerId", model.managerid);

                    _ispcall.Execute("AdminCollectionFromManager", paramter);


                    TempData["success"] = "Record Saved successfully";
                    return(RedirectToAction("ManagerList", "Account", new { roletype = "Manager" }));
                }
            }
            else
            {
                return(View(model));
            }

            //  return View(model);
        }