Exemple #1
0
        public virtual async Task <JsonResult> Add(UserInRole model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { IsSuccessful = false, Message = ModelState.GetModelError() }));
            }
            var addRep = await _userInRoleSrv.Add(model);

            if (!addRep.IsSuccessful)
            {
                return(Json(addRep));
            }
            var getRep = _userInRoleSrv.Get(model.UserId).ToList();

            getRep.ForEach((x) =>
            {
                x.Role.UserInRoles = null;
            });

            return(Json(new Response <string>
            {
                IsSuccessful = true,
                Result = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_List", getRep)
            }));
        }
Exemple #2
0
        public virtual async Task <JsonResult> RecoverPasswrod(string mobileNumber)
        {
            var emailModel = new EmailMessage();

            emailModel.Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_NewPassword", "");

            return(Json(await _userSrv.RecoverPassword(long.Parse(mobileNumber), _config["CustomSettings:EmailServiceConfig:EmailUserName"], emailModel)));
        }
Exemple #3
0
 public virtual async Task <JsonResult> GetViaRole(int roleId)
 => Json(new Modal
 {
     IsSuccessful  = true,
     Title         = $"{DomainString.Action}",
     Body          = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_ListViaRole", _actionInRoleSrv.GetViaRole(roleId)),
     AutoSubmitUrl = Url.Action("Add", "Action"),
     AutoSubmit    = false
 });
Exemple #4
0
 public virtual async Task <JsonResult> Add(int id)
 => Json(new Modal
 {
     AutoSubmit = false,
     Title      = $"{Strings.Add} {DomainString.User}",
     Body       = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", new UserInRole {
         RoleId = id
     }),
     AutoSubmitUrl = Url.Action("Add", "UserInRole"),
 });
 public virtual async Task <JsonResult> Add()
 {
     ViewBag.Categories = GetCategories();
     return(Json(new Modal
     {
         IsSuccessful = true,
         Title = $"{Strings.Add} {DomainString.Product}",
         Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", new Product()),
         AutoSubmit = false
     }));
 }
Exemple #6
0
        public virtual async Task <JsonResult> Update(Guid id)
        {
            var findUser = await _userSrv.FindAsync(id);

            if (!findUser.IsSuccessful)
            {
                return(Json(new Response <string> {
                    IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.User)
                }));
            }

            var organization     = _configuration["CustomSettings:Organizations"].Split(";");
            var organizationList = new List <SelectListItem> {
                new SelectListItem {
                    Text = "", Value = "", Selected = true
                }
            };

            foreach (var item in organization)
            {
                organizationList.Add(new SelectListItem {
                    Text = item, Value = item, Selected = false
                });
            }

            var plans             = _configuration["InsurancePlanSettings:Plans"].Split(";");
            var insurancePlanList = new List <SelectListItem> {
                new SelectListItem {
                    Text = "", Value = "", Selected = true
                }
            };

            foreach (var item in plans)
            {
                insurancePlanList.Add(new SelectListItem {
                    Text = item, Value = item, Selected = false
                });
            }

            ViewBag.OrganizationList = organizationList;
            ViewBag.InsurancePlan    = insurancePlanList;


            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.User}",
                AutoSubmitBtnText = Strings.Edit,
                Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", findUser.Result),
                AutoSubmitUrl = Url.Action("Update", "User"),
                ResetForm = false
            }));
        }
Exemple #7
0
 public virtual async Task <JsonResult> Add()
 {
     ViewBag.Actions = GetActions();
     return(Json(new Modal
     {
         IsSuccessful = true,
         Title = $"{Strings.Add} {DomainString.Action}",
         Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", new Action()),
         AutoSubmitUrl = Url.Action("Add", "Action"),
         AutoSubmit = false,
         ResetForm = true
     }));
 }
 public virtual async Task<JsonResult> Add([FromBody]IList<TempOrderDetail> items)
 {
     if (items == null || items.Count == 0) return Json(new { IsSuccessful = false, Message = Strings.ThereIsNoRecord });
     if (!ModelState.IsValid) return Json(new { IsSuccessful = false, Message = ModelState.GetModelError() });
     var add = await _TempOrderDetailSrv.AddRangeAsync(items);
     if (!add.IsSuccessful) return Json(add);
     var url = $"{_configuration["CustomSettings:ReactTempBasketUrl"]}/{add.Result}";
     return Json(new Response<string>
     {
         IsSuccessful = true,
         Result = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Result", new TempOrderDetailResultModel { Url = url })
     });
 }
Exemple #9
0
        public virtual async Task <JsonResult> Delete(int id)
        {
            var delete = await _productCatSrv.DeleteAsync(id);

            if (!delete.IsSuccessful)
            {
                return(Json(delete));
            }
            return(Json(new
            {
                IsSuccessful = true,
                Result = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_List", _productCatSrv.GetAll(new ProductCategorySearchFilter()))
            }));
        }
Exemple #10
0
        public virtual async Task <JsonResult> Update(int id)
        {
            var findProduct = await _productCatSrv.FindAsync(id);

            if (!findProduct.IsSuccessful)
            {
                return(Json(new Response <string> {
                    IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Product)
                }));
            }
            return(Json(new Response <string>
            {
                IsSuccessful = true,
                Result = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", findProduct.Result)
            }));
        }
        public virtual async Task <JsonResult> Update(Guid id)
        {
            var findUser = await _userSrv.FindAsync(id);

            if (!findUser.IsSuccessful)
            {
                return(Json(new Response <string> {
                    IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.User)
                }));
            }
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.User}",
                AutoSubmitBtnText = Strings.Edit,
                Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", findUser.Result),
                AutoSubmitUrl = Url.Action("Update", "User"),
                ResetForm = false
            }));
        }
Exemple #12
0
        public virtual async Task <IActionResult> Details(Guid id)
        {
            var foundUser = await _userSrv.FindAsync(id);

            if (!foundUser.IsSuccessful)
            {
                return(Json(new Modal {
                    IsSuccessful = false, Message = Strings.NotFound
                }));
            }
            return(Json(new Modal
            {
                IsSuccessful = true,
                Title = $"{Strings.Details} {DomainString.User}",
                AutoSubmitBtnText = Strings.Edit,
                Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Details", foundUser.Result),
                AutoSubmit = false
            }));
        }
Exemple #13
0
        public virtual async Task <JsonResult> Update(int id)
        {
            ViewBag.Actions = GetActions();
            var findRep = await _actionSrv.FindAsync(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new Response <string> {
                    IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Action)
                }));
            }
            _cache.Remove(CacheSettings.MenuModelCacheKey(User.GetUserId()));
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Action}",
                AutoSubmitBtnText = Strings.Edit,
                Body = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_Entity", findRep.Result),
                AutoSubmit = false
            }));
        }
Exemple #14
0
        public virtual async Task <JsonResult> Update(ProductCategory model)
        {
            GetAddPartial();
            if (!ModelState.IsValid)
            {
                return(Json(new Response <string> {
                    IsSuccessful = false, Message = ModelState.GetModelError()
                }));
            }
            var update = await _productCatSrv.UpdateAsync(model);

            if (!update.IsSuccessful)
            {
                return(Json(update));
            }
            return(Json(new
            {
                IsSuccessful = true,
                Result = await ControllerExtension.RenderViewToStringAsync(this, "Partials/_List", _productCatSrv.GetAll(new ProductCategorySearchFilter()))
            }));
        }