Exemple #1
0
        public async Task <ActionResult> Put(int id, [FromBody] Costos_gastosCreacionDTO costos_gastoActualizacion)
        {
            var costos_gasto = mapper.Map <Costos_gastos>(costos_gastoActualizacion);

            costos_gasto.Id = id;
            context.Entry(costos_gasto).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult> Post([FromBody] Costos_gastosCreacionDTO costos_gastoCreacion)
        {
            var costos_gasto = mapper.Map <Costos_gastos>(costos_gastoCreacion);

            context.Add(costos_gasto);
            await context.SaveChangesAsync();

            var costos_gastoDTO = mapper.Map <Costos_gastosDTO>(costos_gasto);

            return(new CreatedAtRouteResult("ObtenerCostos_gastos", new { id = costos_gasto.Id }, costos_gastoDTO));
        }