public async Task <IActionResult> Get(Guid id) { return(await ExecuteFunction(async (user) => { var result = await _titleService.GetById(id); return AutoMapperUtils.AutoMap <Title, TitleViewModel>(result);; })); }
public ActionResult UpdateTitle(int id) { List <SelectListItem> categoryValues = (from x in _categoryService.GetAll() select new SelectListItem { Text = x.Name, Value = x.Id.ToString(), }).ToList(); ViewBag.ValueCategories = categoryValues; var updatedTitle = _titleService.GetById(id); return(View(updatedTitle)); }
public IActionResult GetById(int id) { var result = _titleService.GetById(id); if (result.Success) { return(Ok(result.Data)); } return(BadRequest(result.Message)); }
public IHttpActionResult GetById(int id) { var item = _service.GetById(id); if (item == null) { return(NotFound()); } return(Ok(item)); }
public HttpResponseMessage GetTitle([FromBody] string id) { Guid output; var isValid = Guid.TryParse(id, out output); if (!isValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid Title Id.")); } var result = _titleService.GetById(output); if (result == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "Invalid Title Id.")); } var response = Request.CreateResponse(HttpStatusCode.OK, result); return(response); }