コード例 #1
0
ファイル: NoteService.cs プロジェクト: Mivaweb/Notely
 /// <summary>
 /// Get a single <see cref="Note"/> object
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Note GetById(int id)
 {
     using (var repo = new NotesRepository())
     {
         return(repo.Get(id));
     }
 }
コード例 #2
0
        public IActionResult Get([FromQuery] string itemType, int userId)
        {
            var identity = HttpContext.User.Identity as ClaimsIdentity;
            var id       = identity.FindFirst(ClaimTypes.Name).Value;
            int ID       = Int32.Parse(id);

            try
            {
                return(Ok(NotesRepository.Get(itemType, ID)));
            }
            catch (Exception ex)
            {
                return(BadRequest($"Failed: {ex}"));
            }
        }
コード例 #3
0
        // GET: Notes/Details/5
        public ActionResult Details(int id)
        {
            var model = _notesRepository.Get(id);

            return(View(model));
        }