// GET: Clientes/Details/5
        public ActionResult Details(int id)
        {
            var course          = _courseApp.GetById(id);
            var courseViewModel = Mapper.Map <Course, CourseViewModel>(course);

            return(View(courseViewModel));
        }
Exemple #2
0
        public ActionResult Details(Guid?id)
        {
            ViewBag.Title = "Detalhes";

            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var courseViewModel = courseAppService.GetById(id.Value);

            if (courseViewModel == null)
            {
                return(HttpNotFound());
            }

            return(View(courseViewModel));
        }
Exemple #3
0
        public async Task <IActionResult> AddItem(Guid id)
        {
            var course = await _courseAppService.GetById(id);

            if (course == null)
            {
                return(BadRequest());
            }

            var command = new AddOrderItemCommand(ClientId, course.Id, course.Name, course.Price);
            await _mediatorHandler.SendCommand(command);

            if (IsValidOperation())
            {
                return(RedirectToAction("Index"));
            }

            TempData["Errors"] = this.GetErrors();
            return(RedirectToAction("CourseDetail", "ShowRoom", new { id }));
        }
Exemple #4
0
 public async Task <IActionResult> Get(string id)
 {
     try
     {
         return(Ok(await _courseAppService.GetById(id)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemple #5
0
 public JsonResult GetDetails(int id)
 {
     try
     {
         var ret = _courseApp.GetById(id);
         return(Json(ret));
     }
     catch (Exception e)
     {
         //TODO: IMPLEMENT LOG AND ERRO TREATMENT
         return(Json("Error"));
     }
 }
        public async Task <ResponseBase <Course> > GetById([FromQuery] int courseId)
        {
            try
            {
                GetUserId();
                var courses = await _courseAppService.GetById(courseId);

                return(new ResponseBase <Course>()
                {
                    IsSuccess = true, ErrorDetails = null, Payload = courses
                });
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(new ResponseBase <Course>()
                {
                    ErrorDetails = Error(), IsSuccess = false, Payload = null
                });
            }
        }
Exemple #7
0
 public async Task <IActionResult> EditCourse(Guid id)
 {
     return(View(await FillCategories(await _courseAppService.GetById(id))));
 }
Exemple #8
0
 public async Task <IActionResult> CourseDetail(Guid id)
 {
     return(View(await _courseAppService.GetById(id)));
 }