public void UpdateAchatDetached(Achat e) { utOfWork.AchatRepository.UpdateAchatDetached(e); }
public ActionResult CreateAchat(Achat achat, FormCollection collection) { try { achat.Date_d_achat = System.DateTime.Now; db.Achat.Add(achat); db.SaveChanges(); return RedirectToAction("GetAchat"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public ActionResult EditAchat(Achat acht, FormCollection collection) { try { db1.UpdateAchatDetached(acht); db.SaveChanges(); return RedirectToAction("GetAchat"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public ActionResult EditAchat(Achat achte, FormCollection collection) { if (ModelState.IsValid) { try { DateTime jj = Convert.ToDateTime(achte.Date_d_achat); String hh = jj.ToString("dd-MM-yyyy"); var four = fourni.FindFourByID(achte.Id_fournisseur); // achat.Date_d_achat = System.DateTime.Now; achte.idDelegation = four.idDelegation; db1.UpdateAchatDetached(achte); db1.SaveChange(); return RedirectToAction("GetAchat"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } } else { ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["delegations"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["gouvers"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["fournisseurs"] = new SelectList(BissInventaireEntities.Instance.Fournisseur.ToList(), "Id_fournisseur", "Nom"); ViewData["contratgar"] = new SelectList(BissInventaireEntities.Instance.Contrat.ToList(), "Id_contrat", "Num"); ViewData["achats"] = new SelectList(BissInventaireEntities.Instance.Achat.ToList(), "Id_achat", "Num_facture"); return View(); } }