Exemplo n.º 1
0
        public IHttpActionResult PutPersonal_Info(int id, Personal_Info personal_Info)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(string id)
        {
            Personal_Info personal_Info = db.Personal_Info.Find(id);

            db.Personal_Info.Remove(personal_Info);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Fname,Lname,DOB,Gender,Contact_No,Address")] Personal_Info personal_Info)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personal_Info).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Health_Info"));
     }
     return(View(personal_Info));
 }
Exemplo n.º 4
0
        public IHttpActionResult GetPersonal_Info(int id)
        {
            Personal_Info personal_Info = db.Personal_Info.Find(id);

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

            return(Ok(personal_Info));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Fname,Lname,DOB,Gender,Contact_No,Address")] Personal_Info personal_Info)
        {
            personal_Info.Id = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                db.Personal_Info.Add(personal_Info);
                db.SaveChanges();
                return(RedirectToAction("Index", "Health_Info"));
            }

            return(View(personal_Info));
        }
Exemplo n.º 6
0
        // GET: Personal_Info/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Personal_Info personal_Info = db.Personal_Info.Find(id);

            if (personal_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(personal_Info));
        }
Exemplo n.º 7
0
        public IHttpActionResult DeletePersonal_Info(int id)
        {
            Personal_Info personal_Info = db.Personal_Info.Find(id);

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

            db.Personal_Info.Remove(personal_Info);
            db.SaveChanges();

            return(Ok(personal_Info));
        }
Exemplo n.º 8
0
        public IHttpActionResult PostPersonal_Info(Personal_Info personal_Info)
        {
            try {
                //Personal info
                db.Personal_Info.Add(personal_Info);
                // Personal Experience

                db.SaveChanges();

                return(CreatedAtRoute("DefaultApi", new { id = personal_Info.CandidateId }, personal_Info));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }