Ejemplo n.º 1
0
        public void TestCreateAccountTypes()
        {
            var accountType = Utility.CreateLoanGivenAccountType();

            var repository = new AccountTypeRepository {
                UnitOfWork = new UnitOfWork()
            };

            repository.Create(accountType);

            accountType = Utility.CreateSavingsAccountType();

            repository.Create(accountType);
        }
        // POST api/AccountTypeAPI
        public HttpResponseMessage PostAccountType(AccountType accounttype)
        {
            if (ModelState.IsValid)
            {
                db.Create(accounttype);

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, accounttype);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = accounttype.Id }));
                return(response);
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }