Beispiel #1
0
        public async Task <ActionResult <StudSubjectsModel> > Get(string studno, int id)
        {
            try
            {
                var subject = await _repo.GetSubByStudno(studno, id, true);

                if (subject == null)
                {
                    return(NotFound($"Couldn't find a subject with id of {id}"));
                }
                return(_mapper.Map <StudSubjectsModel>(subject));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to get subject."));
            }
        }