Esempio n. 1
0
        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));
 }
Esempio n. 3
0
        public IActionResult Add(Bank bank)
        {
            var result = _bankService.Add(bank);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Esempio n. 4
0
 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')"));
     }
 }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        public IActionResult Post([FromBody] Bank body)
        {
            var entity = _manager.Add(body);

            return(ResponseJson(entity));
        }