コード例 #1
0
        public async Task <IHttpActionResult> PutPostDetail(int id, PostDetail postDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <IHttpActionResult> PutIndividu(int id, Individu individu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "iD,firstName,lastName,feesPaid,gender,emailId,telephoneNumber,dateOfBirth,isActive")] sp_select_all_id_Result sp_select_all_id_Result)
        {
            if (ModelState.IsValid)
            {
                //db.sp_select_all_id_Result.Add(sp_select_all_id_Result);
                db.sp_contacto_ins(
                    sp_select_all_id_Result.firstName,
                    sp_select_all_id_Result.lastName,
                    sp_select_all_id_Result.feesPaid,
                    sp_select_all_id_Result.gender,
                    sp_select_all_id_Result.emailId,
                    sp_select_all_id_Result.telephoneNumber,
                    sp_select_all_id_Result.dateOfBirth,
                    sp_select_all_id_Result.isActive
                    );
                db.SaveChangesAsync();
                return(RedirectToAction("Index"));
            }

            return(View(sp_select_all_id_Result));
        }