Exemplo n.º 1
0
        public async Task <IHttpActionResult> PutCellTypeMaster(int id, CellTypeMaster cellTypeMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult CreateCell(CellTypeMaster cellMaster)
        {
            var getRm = _capitaContext.CellTypeMasters.ToList();

            foreach (var item in getRm)
            {
                if (item.CellType.Trim().ToLower() == cellMaster.CellType.Trim().ToLower())
                {
                    return(View("CustomerExist"));
                }
            }

            if (cellMaster.Id == 0)
            {
                _capitaContext.CellTypeMasters.Add(cellMaster);
            }
            else
            {
                var vendorIbDB = _capitaContext.CellTypeMasters.Single(v => v.Id == cellMaster.Id);

                vendorIbDB.CellType = cellMaster.CellType;
            }

            _capitaContext.SaveChanges();
            return(RedirectToAction("CreateCellType", "MasterCreation"));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetCellTypeMaster(int id)
        {
            CellTypeMaster cellTypeMaster = await db.CellTypeMasters.FindAsync(id);

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

            return(Ok(cellTypeMaster));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> PostCellTypeMaster(CellTypeMaster cellTypeMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CellTypeMasters.Add(cellTypeMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = cellTypeMaster.Id }, cellTypeMaster));
        }
Exemplo n.º 5
0
        public async Task <IHttpActionResult> DeleteCellTypeMaster(int id)
        {
            CellTypeMaster cellTypeMaster = await db.CellTypeMasters.FindAsync(id);

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

            db.CellTypeMasters.Remove(cellTypeMaster);
            await db.SaveChangesAsync();

            return(Ok(cellTypeMaster));
        }