Exemplo n.º 1
0
        public ActionResult EnableOrDisable(int id)
        {
            if (!CheckPermission(ListsPermissions.ManageLists))
            {
                return(new HttpUnauthorizedResult());
            }

            var item = listItemService.GetById(id);

            item.Enabled = !item.Enabled;
            listItemService.Save(item);
            return(new AjaxResult().NotifyMessage("UPDATE_ENTITY_COMPLETE"));
        }
Exemplo n.º 2
0
        // ne koristim
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var listItem = await _listItemService.GetById(id.Value);

            if (listItem == null)
            {
                return(NotFound());
            }

            return(View(listItem));
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            if (!CheckPermission(ListsPermissions.ManageLists))
            {
                return(new HttpUnauthorizedResult());
            }

            var model    = commentService.GetById(id);
            var listItem = listItemService.GetById(model.ListItemId);
            var list     = listService.GetById(listItem.ListId);

            WorkContext.Breadcrumbs.Add(T("Manage Lists"), Url.Action("Index", "List", new { area = Constants.Areas.Lists }));
            WorkContext.Breadcrumbs.Add(list.Name);
            WorkContext.Breadcrumbs.Add(T("Comments"), Url.Action("Index", new { area = Constants.Areas.Lists }));
            WorkContext.Breadcrumbs.Add(T("Edit"));

            var result = new ControlFormResult <ListItemCommentModel>(model)
            {
                Title                = T("Edit List").Text,
                UpdateActionName     = "Update",
                ShowBoxHeader        = false,
                FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml,
                FormWrapperEndHtml   = Constants.Form.FormWrapperEndHtml
            };

            return(result);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> AddToCart(int id, int shpId)
        {
            var listItem = _listItemService.GetById(id);

            listItem.Result.InCart = !listItem.Result.InCart;

            try
            {
                await _listItemService.Edit(listItem.Result);
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
            return(RedirectToAction("Details", "ShoppingLists", new { id = shpId }));
        }