public void LoadProperty(string propertyName) { if (Id == 0) return; using (var db = new Model1()) { IEnumerable rootCollection = GetRootCollection(db, this.GetType()); rootCollection.GetType().GetMethod("Attach").Invoke(rootCollection, new object[] { this }); this.GetType().GetProperty(propertyName).SetValue(this, db.Entry(this).GetDatabaseValues().GetValue<object>(propertyName)); } }
public ActionResult Edit([Bind(Include = "MaDH,NgayDat,NgayGiao,TinhTrangDonHang,DaThanhToan,MaKH,UuDai")] DonHang donHang) { if (ModelState.IsValid) { db.Entry(donHang).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaKH = new SelectList(db.KhachHangs, "MaKH", "TenKH", donHang.MaKH); return(View(donHang)); }
public ActionResult Edit([Bind(Include = "idCode,Cod_PRO,Informacion")] PRO96_Garantia pRO96_Garantia) { if (ModelState.IsValid) { db.Entry(pRO96_Garantia).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Cod_PRO = new SelectList(db.PRO1_Productos, "Cod_pro", "COD_PRODUCTO", pRO96_Garantia.Cod_PRO); return(View(pRO96_Garantia)); }
public ActionResult Edit([Bind(Include = "ExamScheduleId,ExamId,Date,StartTime,EndTime,LastModifiedDate,LastModifiedBy,CreatedDate,CreatedBy")] ExamSchedule examSchedule) { if (ModelState.IsValid) { db.Entry(examSchedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ExamId = new SelectList(db.ExamDetails, "ExamId", "LastModifiedBy", examSchedule.ExamId); return(View(examSchedule)); }
public async Task <ActionResult> Edit([Bind(Include = "productId,game_title,game_genre,age_restiction_rating,date_release,game_owners,game_ratings,in_Stock,game_price,modable_game,type_of_game")] Game_Inventory game_Inventory) { if (ModelState.IsValid) { db.Entry(game_Inventory).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(game_Inventory)); }
public ActionResult Edit([Bind(Include = "idCode,C8Codigo,C8pROTECCION,C8ePP,C8mASiNFO,pro_hsEG_Codigo")] pRO_hsEG_ePP pRO_hsEG_ePP) { if (ModelState.IsValid) { db.Entry(pRO_hsEG_ePP).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.C8Codigo = new SelectList(db.pRO_hsEG, "Codigo", "C1nOMBRE", pRO_hsEG_ePP.C8Codigo); return(View(pRO_hsEG_ePP)); }
public ActionResult Edit([Bind(Include = "IdOrder,TotalMonney,IdUser,Date")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdUser = new SelectList(db.Users, "IdUser", "NameUser", order.IdUser); return(View(order)); }
public ActionResult Edit([Bind(Include = "Boys,Soccer,Baseball,Rugby")] Sport sport) { if (ModelState.IsValid) { db.Entry(sport).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Boys = new SelectList(db.Teams, "Boys", "Girls", sport.Boys); return(View(sport)); }
public async Task <ActionResult> Edit([Bind(Include = "Username,Picture,Password,Full_Name,Balance,Role")] Account account) { if (ModelState.IsValid) { db.Entry(account).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(account)); }
public ActionResult Edit([Bind(Include = "Id,Code,Name,ShortName,Note,CategoryId")] Products products) { if (ModelState.IsValid) { db.Entry(products).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categorys, "Id", "Name", products.CategoryId); return(View(products)); }
public ActionResult Edit([Bind(Include = "StudentID,BranchId,sem,Fullname,Dob,Address,City,State")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BranchId = new SelectList(db.Branches, "BranchId", "BranchName", student.BranchId); return(View(student)); }
public ActionResult Edit([Bind(Include = "Id,MbId,Paid,AddPoints,PaidDateTime,DateTime")] MbPaid mbPaid) { if (ModelState.IsValid) { db.Entry(mbPaid).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MbId = new SelectList(db.Members, "Id", "Account", mbPaid.MbId); return(View(mbPaid)); }
public ActionResult Save(string message, int mid, int uid) { string str_s = "Successfully Replied!"; bool b_result = true; var user = db.User.Find(uid); user.Message += "Your question has been answered:" + message; db.Entry <User>(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); var result = db.Message.Find(mid); result.Status = "1"; db.Entry <Message>(result).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Content("{\"b_result\":\"" + b_result + "\",\"str_s\":\"" + str_s + "\"}", "json")); }
public ActionResult Edit([Bind(Include = "PresupuestoId,PresupuestoDescripcion,PresupuestoMonto,PresupuestoTipoMoneda,PresupuestoFhActualizacion,PresupuestoFhCreacion")] Presupuesto presupuesto) { if (ModelState.IsValid) { db.Entry(presupuesto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PresupuestoTipoMoneda = new SelectList(db.Monedas, "MonedaId", "MonedaDescripcion", presupuesto.PresupuestoTipoMoneda); return(View(presupuesto)); }
public async Task <ActionResult> Edit([Bind(Include = "代理名稱,代理Id")] C_代理 c_代理) { if (ModelState.IsValid) { db.Entry(c_代理).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(c_代理)); }
public ActionResult Edit([Bind(Include = "IQuestionID,Question,Explanation,InstanceID")] tbiquestion tbiquestion) { if (ModelState.IsValid) { db.Entry(tbiquestion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.InstanceID = new SelectList(db.tbinstances, "InstanceID", "ClassID", tbiquestion.InstanceID); return(View(tbiquestion)); }
public ActionResult Edit([Bind(Include = "ID_ZALACZNIK,ID_ZGLOSZENIA,TRESC")] BOK_ZALACZNIK bOK_ZALACZNIK) { if (ModelState.IsValid) { db.Entry(bOK_ZALACZNIK).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_ZGLOSZENIA = new SelectList(db.BOK_ZGLOSZENIE, "ID_ZGLOSZENIE", "OPIS", bOK_ZALACZNIK.ID_ZGLOSZENIA); return(View(bOK_ZALACZNIK)); }
public ActionResult Edit([Bind(Include = "MABC,MANV,TENBC,LOAIBC,NGAYCAP,DVCAP")] BANGCAP bANGCAP) { if (ModelState.IsValid) { db.Entry(bANGCAP).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MANV = new SelectList(db.NHANVIENs, "MANV", "HOTEN", bANGCAP.MANV); return(View(bANGCAP)); }
public ActionResult Edit([Bind(Include = "LoginProvider,ProviderKey,UserId")] AspNetUserLogins aspNetUserLogins) { if (ModelState.IsValid) { db.Entry(aspNetUserLogins).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", aspNetUserLogins.UserId); return(View(aspNetUserLogins)); }
public ActionResult Edit([Bind(Include = "ServiceCategoryId,Name,Description,PhotoId")] tbl_servicecategory tbl_servicecategory) { if (ModelState.IsValid) { db.Entry(tbl_servicecategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PhotoId = new SelectList(db.tbl_photo, "PhotoId", "URL", tbl_servicecategory.PhotoId); return(View(tbl_servicecategory)); }
public ActionResult Edit([Bind(Include = "ExamId,CategoryId,MaxScore,PassingScore,LastModifiedDate,LastModifiedBy,CreatedDate,CreatedBy")] ExamDetail examDetail) { if (ModelState.IsValid) { db.Entry(examDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", examDetail.CategoryId); return(View(examDetail)); }
public async Task <ActionResult> Edit([Bind(Include = "支付方式id,支付宝,微信,NULl")] C_支付方式 c_支付方式) { if (ModelState.IsValid) { db.Entry(c_支付方式).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(c_支付方式)); }
public ActionResult Edit([Bind(Include = "id_huesped,nombre,direccion,dui,telefono,correo,id_tipo_huesped")] Huesped huesped) { if (ModelState.IsValid) { db.Entry(huesped).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_tipo_huesped = new SelectList(db.Tipo_huesped, "id_tipo_huesped", "tipo", huesped.id_tipo_huesped); return(View(huesped)); }
public ActionResult Edit([Bind(Include = "Id,MbId,Name,SoftwareType,Status,Remarks,ReservationDateTime")] MbCaeSoftwareRecord mbCaeSoftwareRecord) { if (ModelState.IsValid) { db.Entry(mbCaeSoftwareRecord).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MbId = new SelectList(db.Members, "Id", "Account", mbCaeSoftwareRecord.MbId); return(View(mbCaeSoftwareRecord)); }
public ActionResult Edit([Bind(Include = "IPROYECTO_ID,ICLIENTE_ID,VNOMBRE,VDESCRIPCION,TTIEMPO")] Proyecto proyecto) { if (ModelState.IsValid) { db.Entry(proyecto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ICLIENTE_ID = new SelectList(db.Cliente, "ICLIENTE_ID", "VNOMBRE", proyecto.ICLIENTE_ID); return(View(proyecto)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,NOME")] Genero genero) { if (ModelState.IsValid) { db.Entry(genero).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(genero)); }
public ActionResult Edit([Bind(Include = "id,idEmpleado,desde,hasta,comentarios")] Permiso permiso) { if (ModelState.IsValid) { db.Entry(permiso).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idEmpleado = new SelectList(db.Empleadoes, "id", "codigoEmpleado", permiso.idEmpleado); return(View(permiso)); }
public ActionResult Edit([Bind(Include = "id,customer_name,id_customer,address,phone,email,total_price,note,status,created_at")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_customer = new SelectList(db.Customers, "id", "name", order.id_customer); return(View(order)); }
public ActionResult Edit([Bind(Include = "ID_REAGENTE,NM_DESCRICAO,CD_INTERNO,NR_CAS,QT_PESO,UN_MEDIDA,DS_OBS")] TB_REAGENTE tB_REAGENTE) { tB_REAGENTE.DS_STATUS = "A"; if (ModelState.IsValid) { db.Entry(tB_REAGENTE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tB_REAGENTE)); }
public ActionResult Edit([Bind(Include = "QuestionId,Question1,LastModifiedDate,LastModifiedBy,CreatedDate,CreatedBy")] Question question) { if (ModelState.IsValid) { db.Entry(question).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "Question1", question.QuestionId); return(View(question)); }
public void Update(T entity) { //db.Entry(entity).State = EntityState.Modified; using (var db = new Model1()) { db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); } }
// TODO: REFACTOR public IEnumerable LoadCollection(string collectionPropertyName) { using (var db = new Model1()) { IEnumerable rootCollection = GetRootCollection(db, this.GetType()); rootCollection.GetType().GetMethod("Attach").Invoke(rootCollection, new object[] { this }); var dbCollectionEntry = db.Entry(this).Collection(collectionPropertyName); dbCollectionEntry.Load(); IEnumerable childCollection = (IEnumerable)dbCollectionEntry.CurrentValue; childCollection.GetType().GetField("Parent").SetValue(childCollection, this); return childCollection; } }
// TODO: REFACTOR public EFBase LoadReference(string referencePropertyName) { EFBase reference = (EFBase)RealType(this.GetType()).GetProperty(referencePropertyName).GetValue(this); if (reference != null) return reference; using (var db = new Model1()) { IEnumerable rootCollection = GetRootCollection(db, this.GetType()); rootCollection.GetType().GetMethod("Attach").Invoke(rootCollection, new object[] { this }); var dbReferenceEntry = db.Entry(this).Reference(referencePropertyName); dbReferenceEntry.Load(); reference = (EFBase)dbReferenceEntry.CurrentValue; } return reference; }