Exemplo n.º 1
0
        public IActionResult Post([FromBody] AddBenificiary model)
        {
            var result = repository.AddBenificiary(model);

            if (!result)
            {
                return(NotFound("Benificiary not added"));
            }
            return(Ok(result));
        }
Exemplo n.º 2
0
        public bool AddBenificiary(AddBenificiary model)
        {
            var dbcontext   = new OnlinebankingContext();
            var customer    = new OnlinebankingContext().Customer.FirstOrDefault(x => x.AccountNo == model.BenificiaryAccountNo);
            var benificiary = new Benificiary();

            if (customer != null)
            {
                benificiary.CustId = model.cust_id;
                benificiary.BenId  = customer.CustId;
                dbcontext.Benificiary.Add(benificiary);
                dbcontext.SaveChanges();
                return(true);
            }
            return(false);
        }