Example #1
0
        public ActionResult Get(long id)
        {
            MethodBase method = MethodBase.GetCurrentMethod();

            try
            {
                if (id < 1)
                {
                    CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Information);
                    return(BadRequest());
                }

                var response = ActionRepo.Get(id);
                if (response != null)
                {
                    CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information);
                    return(Ok(response));
                }
                else
                {
                    CreateLog(Enums.NotFound, GetMethodCode(method), LogLevel.Warning);
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(HandleError(ex.Message, GetMethodCode(method)));
            }
        }