示例#1
0
        public async Task <ActionResult <PhoneViewModel> > GetById(int id)
        {
            try
            {
                var phone = await _service.GetPhoneAsync(id);

                if (phone == null)
                {
                    return(NotFound());
                }
                return(Ok(phone));
            }
            catch (Exception)
            {
                return(BadRequest(ErrorCode.RecordNotFound));
            }
        }
示例#2
0
        public async Task <IHttpActionResult> GetPhone(int phoneId)
        {
            var phone = await _phoneService.GetPhoneAsync(phoneId);

            return(Ok(phone));
        }
示例#3
0
 public async Task <IActionResult> GetByIdAsync([FromRoute] int id)
 {
     return(ReturnResult(await _phoneService.GetPhoneAsync(id)));
 }