Ejemplo n.º 1
0
        public async Task <IActionResult> CreateAsync(int serviceType)
        {
            ViewBag.serviceType = serviceType;

            ServiceType service = await _serviceTypeRepository.GetServiceTypeByIdAsync(serviceType);

            ViewBag.serviceName  = service.ServiceName;
            ViewBag.servicePrice = service.Pricing;
            return(View());
        }
        public async Task <IActionResult> EditServiceTypeAsync(int id)
        {
            var serviceType = await _serviceTypeRepository.GetServiceTypeByIdAsync(id);

            int _serviceTypeId = id;

            if (serviceType == null)
            {
                ViewBag.ErrorMessage = $"User with category id ={id} cannot be found";
                return(View("NotFound"));
            }


            var model = new EditServiceTypeViewModel
            {
                Id = serviceType.ServiceTypeId,
                ServiceTypeName = serviceType.ServiceName,
                Description     = serviceType.ServiceDescription,
                Pricing         = serviceType.Pricing
            };

            return(View(model));
        }