예제 #1
0
 public ActionResult Edit([Bind(Include = "PaintID,Paintname,CreateDate,Size,Price,Type,ArtistID")] Paint paint)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paint).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistID = new SelectList(db.Artists, "ArtistID", "ArtistName", paint.ArtistID);
     return(View(paint));
 }
예제 #2
0
 public ActionResult preHandle(string id)
 {
     using (MyDB mydb = new MyDB())
     {
         WFInstNode node = mydb.WFInstNodes.Find(id);
         mydb.Entry(node).Reference <WFInst>(n => n.WFInst).Load();
         mydb.Entry(node).Reference <WFNode>(n => n.WFNode).Load();
         mydb.Entry(node.WFInst).Reference <WFTemplate>(n => n.WFTemplate).Load();
         mydb.Entry((WFNodeHandle)node.WFNode).Collection <WFNodeAction>(n => n.Actions).Load();
         mydb.Entry(node.WFInst).Collection <WFInstNode>(inst => inst.WFInstNodes).Load();
         return(View("tohandle", node));
     }
 }
예제 #3
0
        public TEntity Update(TEntity entity, int id)
        {
            var entityCorrente = context.Set <TEntity>().AsNoTracking().FirstOrDefault(o => o.Id == id);

            if (entityCorrente is null)
            {
                throw new ArgumentException(nameof(id));
            }

            context.Entry <TEntity>(entity).State = EntityState.Modified;
            context.SaveChanges();

            return(entity);
        }
        public IHttpActionResult Putemployee_tbl(int id, employee_tbl employee_tbl)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #5
0
        public IHttpActionResult PutContent(int id, Content content)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #6
0
 public void sss()
 {
     using (MyDB mydb = new MyDB())
     {
         User user = mydb.Users.First(u => u.Code.Contains("lx"));
         mydb.Entry(user).Collection(u => u.CreateWFTemplates).Query().Load();
     }
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "LocationID,Long,Lat,Address")] Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(location));
 }
 public ActionResult Edit([Bind(Include = "flightBoardID,boardName,flightID")] FlightBoard flightBoard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flightBoard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flightBoard));
 }
예제 #9
0
 public ActionResult Edit([Bind(Include = "DealID,PropertyID,CustomerID,BrokerID,Price,Commition,Categorty")] Deal deal)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deal).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deal));
 }
 public ActionResult Edit([Bind(Include = "id,name,seats,seats_left,gig_date,description,seat_price")] Gig gig)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gig).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gig));
 }
예제 #11
0
 public ActionResult Edit([Bind(Include = "Id,Station,Text,Date,PreFunc,PostFunc")] Content content)
 {
     if (ModelState.IsValid)
     {
         db.Entry(content).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(content));
 }
 public ActionResult Edit([Bind(Include = "BrokerID,Name,Deals")] Broker broker)
 {
     if (ModelState.IsValid)
     {
         db.Entry(broker).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(broker));
 }
예제 #13
0
 public ActionResult Edit([Bind(Include = "QuestionRoomID,Title,Creator")] QuestionRoom questionRoom)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questionRoom).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(questionRoom));
 }
예제 #14
0
 public ActionResult Edit([Bind(Include = "CustomerID,CustName,Email,Gender,PhoneNum")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
 public ActionResult Edit([Bind(Include = "UserName,FirstName,Gender,BirthDay,Email,Password,Description,Score")] Professional professional)
 {
     if (ModelState.IsValid)
     {
         db.Entry(professional).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(professional));
 }
 public ActionResult Edit([Bind(Include = "Profession_Name")] Profession profession)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profession).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(profession));
 }
예제 #17
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(course));
 }
예제 #18
0
 public ActionResult Edit([Bind(Include = "ID_NHOM,tennhomtin")] NHOMTIN nHOMTIN)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nHOMTIN).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nHOMTIN));
 }
 public ActionResult Edit([Bind(Include = "ContactId,name,email,subject,messenge")] Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contact));
 }
예제 #20
0
 public ActionResult Edit([Bind(Include = "ID,Title,Body,SentBy,Posted")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(comment));
 }
예제 #21
0
 public ActionResult Edit([Bind(Include = "ID_TK,username,password,tentk,phone,mail,diachi")] TAIKHOAN tAIKHOAN)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tAIKHOAN).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tAIKHOAN));
 }
예제 #22
0
 public ActionResult Edit([Bind(Include = "Id,Location,Station")] Marquee marquee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(marquee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(marquee));
 }
 public ActionResult Edit([Bind(Include = "PersonID,FirstName,LastName,UserName,Password,Permission,CreditCardID")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
 public ActionResult Edit([Bind(Include = "PropertyID,Adress,NumOfRooms,Price,Type,Elevator,Balcony,Parking,Category,SQfeet,About")] Property property)
 {
     if (ModelState.IsValid)
     {
         db.Entry(property).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(property));
 }
 public ActionResult Edit([Bind(Include = "AdminID,FirstName,LastName,UserName,Password")] Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin));
 }
예제 #26
0
 public ActionResult Edit([Bind(Include = "userID,type,name,password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
예제 #27
0
 public ActionResult Edit([Bind(Include = "ArtistID,ArtistName,Email,FavoriteStyle,Rate")] Artist artist)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(artist));
 }
예제 #28
0
 public ActionResult Edit([Bind(Include = "UserName,FirstName,Gender,BirthDay,Email,Password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
예제 #29
0
 public ActionResult Edit([Bind(Include = "Id,Station,Uid")] Owner owner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(owner).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(owner));
 }
 public ActionResult Edit([Bind(Include = "flightAttendantID,name")] FlightAttendant flightAttendant)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flightAttendant).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flightAttendant));
 }