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

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

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

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

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

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

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

            db.transaccions.Add(transaccions);
            await db.SaveChangesAsync();

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

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

            db.transaccions.Remove(transaccions);
            await db.SaveChangesAsync();

            return(Ok(transaccions));
        }