public async Task <IHttpActionResult> PostIdentityUserClaim(IdentityUserClaimVm vm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = Task.Factory.StartNew(() =>
            {
                IUnitOfWork uow = new UnitOfWorkImp(new IRepositoryConnection[] { IdentityUserClaimRepository });
                var bo          = (BOIdentityUserClaim)vm.BOIdentityUserClaim(IdentityUserClaimRepository);
                uow.Create(bo);

                string err;
                if (!uow.Commit(out err))
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(err)
                    };
                    throw new HttpResponseException(resp);
                }
                vm = new IdentityUserClaimVm(bo);
                return(true);
            });
            await result;

            return(CreatedAtRoute("DefaultApi", new { id = vm.Id }, vm));
        }
        public async Task <IHttpActionResult> DeleteIdentityUserClaim(Int32 id)
        {
            var result = Task.Factory.StartNew(() =>
            {
                IUnitOfWork uow = new UnitOfWorkImp(new IRepositoryConnection[] { IdentityUserClaimRepository });
                var bo          = new BOIdentityUserClaim();
                bo.Repository   = IdentityUserClaimRepository;
                bo.Init(id);

                uow.Delete(bo);

                string err;
                if (!uow.Commit(out err))
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(err)
                    };
                    throw new HttpResponseException(resp);
                }
                return(true);
            });
            await result;

            if (!result.Result)
            {
                return(NotFound());
            }

            return(Ok(result.Result));
        }
        public async Task <IHttpActionResult> PutIdentityUserClaim(Int32 id, IdentityUserClaimVm vm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vm.Id)
            {
                return(BadRequest());
            }

            var result = Task.Factory.StartNew(() => {
                IUnitOfWork uow = new UnitOfWorkImp(new IRepositoryConnection[] { IdentityUserClaimRepository });
                var bo          = (BOIdentityUserClaim)vm.BOIdentityUserClaim(IdentityUserClaimRepository);
                uow.Update(bo);

                string err;
                if (!uow.Commit(out err))
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(err)
                    };
                    throw new HttpResponseException(resp);
                }
                return(true);
            });
            await result;

            if (!result.Result)
            {
                return(NotFound());
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PutCustomerDemographics(string id, CustomerDemographicsVm vm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vm.CustomerTypeID)
            {
                return(BadRequest());
            }

            var result = Task.Factory.StartNew(() => {
                IUnitOfWork uow = new UnitOfWorkImp(new IRepositoryConnection[] { CustomerDemographicsRepository });
                var bo          = (BOCustomerDemographics)vm.BOCustomerDemographics(CustomerDemographicsRepository);
                uow.Update(bo);

                string err;
                if (!uow.Commit(out err))
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(err)
                    };
                    throw new HttpResponseException(resp);
                }
                return(true);
            });
            await result;

            if (!result.Result)
            {
                return(NotFound());
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }