コード例 #1
0
        private void UpdateDBChangesLock(Object entity)
        {
            lock (obj)
            {
                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;

                db.SaveChanges();
            }
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,FullName,Email,Role,IsDeleted,CompanyCode,CreationDate")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyCode = new SelectList(db.Companies, "Code", "Name", user.CompanyCode);
     return(View(user));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Content,CreationDate,UserId,ExecutionId")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ExecutionId = new SelectList(db.Executions, "Id", "MachineIP", comment.ExecutionId);
     ViewBag.UserId      = new SelectList(db.Users, "Id", "FullName", comment.UserId);
     return(View(comment));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "IP,VLan,IsDeleted,CompanyCode,CreationDate,CountryId")] Machine machine)
 {
     if (ModelState.IsValid)
     {
         db.Entry(machine).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyCode = new SelectList(db.Companies, "Code", "Name", machine.CompanyCode);
     ViewBag.CountryId   = new SelectList(db.Countries, "Id", "Name", machine.CountryId);
     return(View(machine));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "Id,CreationDate,Status,SrartTime,EndTime,ScheduleTime,UserId,ReasonId,MachineVLan,MachineIP")] Execution execution)
 {
     if (ModelState.IsValid)
     {
         db.Entry(execution).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MachineIP = new SelectList(db.Machines, "IP", "IP", execution.MachineIP);
     ViewBag.ReasonId  = new SelectList(db.Reasons, "Id", "ReasonName", execution.ReasonId);
     ViewBag.UserId    = new SelectList(db.Users, "Id", "FullName", execution.UserId);
     return(View(execution));
 }
コード例 #6
0
        public ActionResult Edit([Bind(Include = "Code,Name,Logo")] Company company)
        {
            if (ModelState.IsValid)
            {
                db.Entry(company).State = EntityState.Modified;
                db.SaveChanges();

                ViewBag.ModelName = "Company";
                ViewBag.ItemName  = company.Name;

                return(PartialView("SuccessPage"));
            }
            return(PartialView(company));
        }