コード例 #1
0
        public IHttpActionResult PutAadharMaster(int id, AadharMaster aadharMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AadharMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetAadharMaster(int id)
        {
            AadharMaster aadharMaster = db.AadharMasters.Find(id);

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

            return(Ok(aadharMaster));
        }
コード例 #3
0
        public IHttpActionResult PostAadharMaster(AadharMaster aadharMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AadharMasters.Add(aadharMaster);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = aadharMaster.id }, aadharMaster));
        }
コード例 #4
0
        public IHttpActionResult DeleteAadharMaster(int id)
        {
            AadharMaster aadharMaster = db.AadharMasters.Find(id);

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

            db.AadharMasters.Remove(aadharMaster);
            db.SaveChanges();

            return(Ok(aadharMaster));
        }