Beispiel #1
0
        public IHttpActionResult PutTestDetail(int id, TestDetail testDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IHttpActionResult PutMostRecentLoggingEvent(long id, MostRecentLoggingEvent mostRecentLoggingEvent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit(education__institution education__institution)
 {
     if (ModelState.IsValid)
     {
         audit_object site = db.audit_object.Find(education__institution.audit_object_id);
         site.adress_site = education__institution.audit_object.adress_site;
         db.audit_object.AddOrUpdate(site);
         db.SaveChanges();
         education__institution.audit_object    = null;
         db.Entry(education__institution).State = EntityState.Modified;
         db.SaveChanges();
     }
     ViewBag.audit_object_id             = new SelectList(db.audit_object, "id", "title_site", education__institution.audit_object_id);
     ViewBag.department_subordination_id = new SelectList(db.department_subordination, "id", "name", education__institution.department_subordination_id);
     ViewBag.district_id = new SelectList(db.district, "id", "name", education__institution.district_id);
     if (education__institution.district_id > 0)
     {
         ViewBag.area_id = new SelectList(db.area, "id", "name", db.district.Find(education__institution.district_id).area_id);
     }
     else
     {
         ViewBag.area_id = new SelectList(db.area, "id", "name");
     }
     ViewBag.kind_edu_id                   = new SelectList(db.kind_edu, "id", "name", education__institution.kind_edu_id);
     ViewBag.ownership_type_id             = new SelectList(db.ownership_type, "id", "name", education__institution.ownership_type_id);
     ViewBag.type_edu_id                   = new SelectList(db.type_edu, "id", "name", education__institution.type_edu_id);
     ViewBag.type_education_institution_id = new SelectList(db.type_education_institution, "id", "nane", education__institution.type_education_institution_id);
     return(View(education__institution));
 }