Beispiel #1
0
        public async Task <IHttpActionResult> PuttblCustomerAccount(int id, tblCustomerAccount tblCustomerAccount)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblCustomerAccount.CustomerAccountId)
            {
                return(BadRequest());
            }

            db.Entry(tblCustomerAccount).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblCustomerAccountExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> GettblCustomerAccount(int id)
        {
            tblCustomerAccount tblCustomerAccount = await db.tblCustomerAccounts.FindAsync(id);

            if (tblCustomerAccount == null)
            {
                return(NotFound());
            }

            return(Ok(tblCustomerAccount));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> PosttblCustomerAccount(tblCustomerAccount tblCustomerAccount)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblCustomerAccounts.Add(tblCustomerAccount);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = tblCustomerAccount.CustomerAccountId }, tblCustomerAccount));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeletetblCustomerAccount(int id)
        {
            tblCustomerAccount tblCustomerAccount = await db.tblCustomerAccounts.FindAsync(id);

            if (tblCustomerAccount == null)
            {
                return(NotFound());
            }

            db.tblCustomerAccounts.Remove(tblCustomerAccount);
            await db.SaveChangesAsync();

            return(Ok(tblCustomerAccount));
        }