// GET: Banks/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BankViewModel bank = Mapper.Map <BankViewModel>(bankService.Get(id.Value)); if (bank == null) { return(HttpNotFound()); } return(View(bank)); }
public async Task <ActionResult <BankDto> > Get(Guid id) { try { return(Ok(_mapper.Map <BankDto>(await _bankService.Get(id)))); } catch (KeyNotFoundException) { return(NotFound()); } catch { return(StatusCode(500)); } }
public IActionResult Get(int id) { var bank = _BankService.Get(id).Result; var response = _mapper.Map <BankResponse>(bank); return(Ok(response)); }
public IActionResult Get(int id) { if (id <= 0) { return(ResponseModel.Instance.ReturnResult(HttpStatusCode.NotAcceptable, "Id canot be less or equal to 0.")); } var result = _service.Get(id); return(ResponseModel.Instance.ReturnResult(HttpStatusCode.OK, result)); }
public void Bank_Get_Single() { //Arrange int id = 1; _mockRepository.Setup(x => x.Get(id)).Returns(listbank.FirstOrDefault(x => x.ID == id)); //Act var result = _service.Get(id); //Assert Assert.NotNull(result); }
public ActionResult Get(long id) { return(Content(bankService.Get(id).Name)); }
public async Task <ActionResult <Bank> > GetBank(string id) { var bank = await _bankService.Get(id) ?? new Bank(); return(Ok(bank)); }