public void Add_Bank() { //Arrange var bank = new Bank { ID = 4, Name = "Test Bank" }; _mockRepository.Setup(x => x.Add(bank)).Returns(1); //Act var result = _service.Add(bank); //Assert. Assert.Equal(1, result); }
public IActionResult Post([FromBody] Bank value) { if (value == null) { return(ResponseModel.Instance.ReturnResult(HttpStatusCode.NotAcceptable, "value cannot be null.")); } _service.Add(value); return(ResponseModel.Instance.ReturnResult(HttpStatusCode.OK)); }
public IActionResult Add(Bank bank) { var result = _bankService.Add(bank); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public JavaScriptResult Create(BankViewModel bankvm) { try { _bankService.Add(Mapper.Map <Bank>(bankvm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/Bank"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public async Task <ActionResult <Result> > Create(Bank bank) { var result = await _bankService.Add(new Bank { Id = Guid.NewGuid().ToString(), Name = bank.Name, CreatedUsername = bank.CreatedUsername, CreatedOn = DateTime.Now, UpdatedUsername = null, UpdatedOn = default(DateTime), Comments = "Bank Entity Creation" }); return(Ok(result)); }
public IActionResult Post([FromBody] Bank body) { var entity = _manager.Add(body); return(ResponseJson(entity)); }