public virtual JsonResult Add()
 => Json(new Modal
 {
     Title         = $"{Strings.Add} {DomainString.User}",
     Body          = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new User()),
     AutoSubmitUrl = Url.Action("Add", "User")
 });
Exemple #2
0
        public virtual async Task <JsonResult> Update(int id)
        {
            var findRep = await _relativeSrv.FindWithAttachmentsAsync(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Relatives) }));
            }
            if (findRep.Result.RelativeAttachments != null)
            {
                foreach (var item in findRep.Result.RelativeAttachments)
                {
                    item.Url = $"{_configuration["CustomSettings:MainAddress"]}{item.Url}";
                }
            }

            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Relatives}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", findRep.Result),
                AutoSubmit = false,
                ResetForm = false
            }));
        }
        public virtual async Task <JsonResult> Update(int id)
        {
            var chk = await _OrderSrv.CheckOwner(User.GetUserId(), id);

            if (!chk)
            {
                return(Json(new Modal {
                    IsSuccessful = false, Message = Strings.RecordNotFound
                }));
            }
            var findRep = await _OrderSrv.FindAsync(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Order) }));
            }
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Order}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", findRep.Result),
                AutoSubmitUrl = Url.Action("Update", "StoreOrder"),
                ResetForm = false
            }));
        }
 public virtual JsonResult Add()
 => Json(new Modal
 {
     Title      = $"{Strings.Add} {DomainString.Relatives}",
     Body       = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new Relative()),
     AutoSubmit = false,
 });
 public virtual JsonResult Add()
     => Json(new Modal
     {
         Title = $"{Strings.Add} {DomainString.Basket}",
         Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new TempOrderDetail()),
         AutoSubmit = false
     });
Exemple #6
0
        public virtual async Task <JsonResult> Update([FromServices] IAddressService addrSrv, int id)
        {
            var store = await _storeSrv.FindAsync(id);

            if (!store.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound }));
            }
            //var model = new StoreUpdateModel().CopyFrom(store.Result);
            if (store.Result.AddressId != null)
            {
                var addr = await addrSrv.FindAsync(store.Result.AddressId ?? 0);

                store.Result.Address = addr.IsSuccessful ? addr.Result : new Address();
            }
            else
            {
                store.Result.Address = new Address();
            }
            store.Result.ShopiaUrl = $"{_configuration["CustomSettings:ReactBaseUrl"]}/store/{id}";
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Store}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", store.Result),
                AutoSubmit = false
            }));
        }
Exemple #7
0
        public virtual async Task <JsonResult> Add(ActionInRole model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { IsSuccessful = false, Message = ModelState.GetModelError() }));
            }
            var addRep = await _actionInRoleSrv.AddAsync(model);

            if (!addRep.IsSuccessful)
            {
                return(Json(addRep));
            }
            var getRep = _actionInRoleSrv.GetViaAction(model.ActionId).ToList();

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

            return(Json(new Response <string>
            {
                IsSuccessful = true,
                Result = ControllerExtension.RenderViewToString(this, "Partials/_ListViaAction", getRep)
            }));
        }
 public virtual JsonResult Add()
 => Json(new Modal
 {
     Title = $"{Strings.Add} {DomainString.Role}",
     Body  = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new Role {
         Enabled = true
     }),
     AutoSubmitUrl = Url.Action("Add", "Role")
 });
 public virtual JsonResult Add()
 {
     ViewBag.Types = GetTypes();
     return(Json(new Modal
     {
         Title = $"{Strings.Add} {DomainString.Loss}",
         Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new Loss()),
         AutoSubmit = false
     }));
 }
 public virtual JsonResult Details(Guid id)
 {
     ViewBag.BasketUrl = $"{_configuration["CustomSettings:ReactTempBasketUrl"]}/{id}";
     return Json(new Modal
     {
         Title = $"{Strings.Details} {DomainString.Basket}",
         AutoSubmitBtnText = Strings.Edit,
         Body = ControllerExtension.RenderViewToString(this, "Partials/_Details", _TempOrderDetailSrv.GetDetails(id)),
         AutoSubmit = false
     });
 }
        public virtual async Task <JsonResult> Update(int id)
        {
            var findRep = await _productSerive.FindAsync(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.NotFound }));
            }
            ViewBag.Categories = GetCategories();
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Product}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", findRep.Result),
                AutoSubmit = false
            }));
        }
        public virtual async Task <JsonResult> Details(int id)
        {
            var findRep = await _OrderSrv.GetDetails(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Order) }));
            }

            return(Json(new Modal
            {
                Title = $"{Strings.Details} {DomainString.Order}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Details", findRep.Result),
                AutoSubmit = false
            }));
        }
        public virtual async Task <JsonResult> Update(int id)
        {
            var findRep = await _roleSrv.FindAsync(id);

            if (!findRep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Role) }));
            }

            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Role}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", findRep.Result),
                AutoSubmitUrl = Url.Action("Update", "Role"),
                ResetForm = false
            }));
        }
Exemple #14
0
        public async Task <IActionResult> ShowPage(StoreType storeType, string username)
        {
            using var http = new HttpClient();
            var apiCall = await http.GetAsync($"{_configuration["CustomSettings:Crawler:GetPage"]}?username={username}");

            if (!apiCall.IsSuccessStatusCode)
            {
                return(Json(new Response <string> {
                    Message = Strings.Error
                }));
            }
            var response = await apiCall.Content.ReadAsStringAsync();

            var crawl = response.DeSerializeJson <Response <CrawledPageDto> >();

            return(Json(new Response <string>
            {
                IsSuccessful = crawl.IsSuccessful,
                Message = crawl.Message,
                Result = ControllerExtension.RenderViewToString(this, "Partials/_Instagram", crawl.Result),
            }));
        }
        public virtual async Task <JsonResult> Update([FromServices] IRelativeService relativeSrv, int id)
        {
            var find = await _LossSrv.FindAsync(id);

            if (!find.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound.Fill(DomainString.Loss) }));
            }
            ViewBag.Types = GetTypes();
            if (find.Result.RelativeId != null)
            {
                var rel = await relativeSrv.FindAsync(find.Result.RelativeId ?? 0);

                find.Result.Relative = rel.Result;
            }
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Loss}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", find.Result),
                AutoSubmit = false
            }));
        }
Exemple #16
0
        public virtual async Task <JsonResult> Update([FromServices] IAddressService addrSrv, int id)
        {
            var chk = await _storeSrv.CheckOwner(id, User.GetUserId());

            if (!chk)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.AccessDenied }));
            }
            var store = await _storeSrv.FindAsync(id);

            if (!store.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, Message = Strings.RecordNotFound }));
            }
            var model = new StoreUpdateModel().CopyFrom(store.Result);

            if (store.Result.AddressId != null)
            {
                var addr = await addrSrv.FindAsync(store.Result.AddressId ?? 0);

                if (addr.IsSuccessful)
                {
                    model.Address.Latitude       = addr.Result.Latitude;
                    model.Address.Longitude      = addr.Result.Longitude;
                    model.Address.AddressDetails = addr.Result.AddressDetails;
                }
            }

            model.ShopiaUrl = $"{_configuration["CustomSettings:ReactBaseUrl"]}/store/{id}";
            return(Json(new Modal
            {
                Title = $"{Strings.Update} {DomainString.Store}",
                AutoSubmitBtnText = Strings.Edit,
                Body = ControllerExtension.RenderViewToString(this, "Partials/_Entity", store.Result),
                AutoSubmit = false
            }));
        }
Exemple #17
0
 public virtual ActionResult Manage(ProductCategorySearchFilter filter)
 {
     GetAddPartial();
     ViewBag.EntityPartial = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new ProductCategory());
     return(View(_productCatSrv.GetAll(filter)));
 }
Exemple #18
0
 private void GetAddPartial() => ViewBag.EntityPartial = ControllerExtension.RenderViewToString(this, "Partials/_Entity", new ProductCategory());