Exemple #1
0
        public async Task <IActionResult> PostNCSystem([FromBody] NCSystem nCSystem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NCSystems.Add(nCSystem);
            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (NCSystemExists(nCSystem.Id))
                {
                    return(StatusCode((int)HttpStatusCode.Conflict));
                }
                else
                {
                    throw;
                }
            }
            return(CreatedAtRoute("DefaultApi", new { id = nCSystem.Id }, nCSystem));
        }
Exemple #2
0
        public async Task<IHttpActionResult> PutNCSystem(int id, NCSystem nCSystem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemple #3
0
        public async Task <IActionResult> PutNCSystem(int id, [FromBody] NCSystem nCSystem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode((int)HttpStatusCode.NoContent));
        }
Exemple #4
0
        public async Task <IActionResult> GetNCSystem(int id)
        {
            NCSystem nCSystem = await db.NCSystems.FindAsync(id);

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

            return(Ok(nCSystem));
        }
Exemple #5
0
        public async Task<IHttpActionResult> PostNCSystem(NCSystem nCSystem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.NCSystems.Add(nCSystem);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = nCSystem.Id }, nCSystem);
        }
Exemple #6
0
        public async Task <IHttpActionResult> PostNCSystem(NCSystem nCSystem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NCSystems.Add(nCSystem);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = nCSystem.Id }, nCSystem));
        }
Exemple #7
0
        public async Task <IActionResult> DeleteNCSystem(int id)
        {
            NCSystem nCSystem = await db.NCSystems.FindAsync(id);

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

            db.NCSystems.Remove(nCSystem);
            await db.SaveChangesAsync();

            return(Ok(nCSystem));
        }
        private void AddNCSystem(NCSystem system)
        {
            var       table = document.Tables[ncSystemIndex];
            Paragraph p     = table.Rows[0].Cells[1].Paragraphs.FirstOrDefault();

            p.Append(system.TypeID);
            p = table.Rows[1].Cells[1].Paragraphs.FirstOrDefault();
            p.Append(system.SupportMachineType);
            p = table.Rows[2].Cells[1].Paragraphs.FirstOrDefault();
            p.Append(system.NumberOfSupportChannels.Value.ToString());
            p = table.Rows[3].Cells[1].Paragraphs.FirstOrDefault();
            p.Append(system.MaxNumberOfFeedSystemAxis.Value.ToString());
            p = table.Rows[4].Cells[1].Paragraphs.FirstOrDefault();
            p.Append(system.MaxNumberOfSpindleAxis.Value.ToString());
            p = table.Rows[5].Cells[1].Paragraphs.FirstOrDefault();
            p.Append(system.MaxNumberOfLinkageAxis.Value.ToString());
        }