Esempio n. 1
0
        public async Task <IHttpActionResult> PutCostCenter_ServiceLine_KPIs(int id, CostCenter_ServiceLine_KPIs costCenter_ServiceLine_KPIs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> DeleteCostCenter_ServiceLine_KPIs(int id)
        {
            CostCenter_ServiceLine_KPIs costCenter_ServiceLine_KPIs = await db.CostCenter_ServiceLine_KPIs.FindAsync(id);

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

            costCenter_ServiceLine_KPIs.IsDeleted = true;
            await db.SaveChangesAsync();

            return(Ok(costCenter_ServiceLine_KPIs));
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> PostCostCenter_ServiceLine_KPIs(CostCenter_ServiceLine_KPIs costCenter_ServiceLine_KPIs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CostCenter_ServiceLine_KPIs.Add(costCenter_ServiceLine_KPIs);
            await db.SaveChangesAsync();

            costCenter_ServiceLine_KPIs.CostCenter_ServiceLine = db.CostCenter_ServiceLine.SingleOrDefault(c => c.ID == costCenter_ServiceLine_KPIs.FK_CostCenterServiceline);
            costCenter_ServiceLine_KPIs.KPI        = db.KPIs.SingleOrDefault(k => k.ID == costCenter_ServiceLine_KPIs.FK_KPI);
            costCenter_ServiceLine_KPIs.FiscalYear = db.FiscalYears.SingleOrDefault(f => f.ID == costCenter_ServiceLine_KPIs.FK_FiscalYear);

            return(CreatedAtRoute("DefaultApi", new { id = costCenter_ServiceLine_KPIs.ID }, costCenter_ServiceLine_KPIs));
        }