Exemplo n.º 1
0
        public ActionResult Error(int id)
        {
            CategoryView categoryView = new CategoryView(serviceCategories.GetCategory(Convert.ToInt32(id)));

            if (categoryView == null)
            {
                return(HttpNotFound());
            }
            return(View(categoryView));
        }
Exemplo n.º 2
0
        // GET: Categories/Edit/5
        public async Task<IActionResult> Edit(int? categoryId)
        {
            if (categoryId == null)
                return NotFound();

			var category = await _serviceCategories.GetCategory(categoryId.Value);
			if (category == null)
                return NotFound();

			TmpPicture.Add(new Utilities.PictureFile() { Id = category.CategoryId.ToString(),
								 TmpPicture = category.Picture });

			return View(category);
        }
Exemplo n.º 3
0
		// GET: Categories/Details/5
		public async Task<IActionResult> Details(int? categoryId)
        {
            if (categoryId == null)
				return NotFound();

			var category = new ServiceCategories(_configuration);
			var _result = await category.GetCategory(categoryId.Value);

			if (_result == null)
                return NotFound();

            return View(_result);
        }
Exemplo n.º 4
0
        public async static Task <string> GetDetail(string code, DetailService detailService, IConfiguration _configuration)
        {
            string returnValue = string.Empty;

            switch (detailService)
            {
            case DetailService.Category:
                ServiceCategories serviceCategories = new ServiceCategories(_configuration);

                var Category = await serviceCategories.GetCategory(int.Parse(code));

                returnValue = Category.CategoryName;

                break;

            case DetailService.Customer:
                ServiceCustomers serviceCustomers = new ServiceCustomers(_configuration);

                var Customer = await serviceCustomers.GetCustomer(code);

                returnValue = Customer.ContactName;

                break;

            case DetailService.Employee:
                ServiceEmployees serviceEmployees = new ServiceEmployees(_configuration);

                var Employee = await serviceEmployees.GetEmployee(int.Parse(code));

                returnValue = Employee.FirstName + ' ' + Employee.LastName;

                break;

            case DetailService.Region:
                ServiceRegion serviceRegion = new ServiceRegion(_configuration);

                var Region = await serviceRegion.GetRegion(int.Parse(code));

                returnValue = Region.RegionDescription;

                break;
            }
            return(returnValue);
        }