示例#1
0
        // GET: Admin/Categories/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Category category = await _category.GetByIdAsync(id);

            if (category == null)
            {
                return(HttpNotFound());
            }
            return(View(category));
        }
示例#2
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var category = await _categoryServices.GetByIdAsync((int)id);

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

            return(View(category));
        }
        public async Task <IActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var category = await _categoryServices.GetByIdAsync(id);

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

            var categoryViewModel = new CategoryViewModel()
            {
                Id      = category.Id,
                Slug    = category.Slug,
                Name    = category.Name,
                Content = category.Content,
            };

            return(View(categoryViewModel));
        }
        public IResponseDTO GetById(int id)
        {
            var result = ServicesCategory.GetByIdAsync(id);

            return(result);
        }