コード例 #1
0
 public async Task <IActionResult> Get(Guid id)
 {
     return(await ExecuteFunction(async (user) =>
     {
         var result = await _titleService.GetById(id);
         return AutoMapperUtils.AutoMap <Title, TitleViewModel>(result);;
     }));
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        public IActionResult GetById(int id)
        {
            var result = _titleService.GetById(id);

            if (result.Success)
            {
                return(Ok(result.Data));
            }

            return(BadRequest(result.Message));
        }
コード例 #4
0
ファイル: TitleController.cs プロジェクト: pninar/KolgraphWeb
        public IHttpActionResult GetById(int id)
        {
            var item = _service.GetById(id);

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

            return(Ok(item));
        }
コード例 #5
0
        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);
        }