Пример #1
0
        public IHttpActionResult PutFamilyViolenceFile(int id, FamilyViolenceFile familyViolenceFile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            FamilyViolenceFile familyViolenceFile = db.FamilyViolenceFiles.Find(id);

            db.FamilyViolenceFiles.Remove(familyViolenceFile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,value")] FamilyViolenceFile familyViolenceFile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(familyViolenceFile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(familyViolenceFile));
 }
        public ActionResult Create([Bind(Include = "id,value")] FamilyViolenceFile familyViolenceFile)
        {
            if (ModelState.IsValid)
            {
                db.FamilyViolenceFiles.Add(familyViolenceFile);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(familyViolenceFile));
        }
Пример #5
0
        public IHttpActionResult GetFamilyViolenceFile(int id)
        {
            FamilyViolenceFile familyViolenceFile = db.FamilyViolenceFiles.Find(id);

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

            return(Ok(familyViolenceFile));
        }
Пример #6
0
        public IHttpActionResult PostFamilyViolenceFile(FamilyViolenceFile familyViolenceFile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.FamilyViolenceFiles.Add(familyViolenceFile);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = familyViolenceFile.FamilyViolenceFileId }, familyViolenceFile));
        }
        // GET: FamilyViolenceFiles/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FamilyViolenceFile familyViolenceFile = db.FamilyViolenceFiles.Find(id);

            if (familyViolenceFile == null)
            {
                return(HttpNotFound());
            }
            return(View(familyViolenceFile));
        }
Пример #8
0
        public IHttpActionResult DeleteFamilyViolenceFile(int id)
        {
            FamilyViolenceFile familyViolenceFile = db.FamilyViolenceFiles.Find(id);

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

            db.FamilyViolenceFiles.Remove(familyViolenceFile);
            db.SaveChanges();

            return(Ok(familyViolenceFile));
        }