So basically I’m kind a new in MVC and I’m learning the basics. I need to edit a row in my X table when I edit a row on the Y table

Controller Edit

public ActionResult Edit([Bind(Include = "DespesaId,TipoDespesaId,DespesaDescricao,DespesaValor,TipoPagamentoId,Data,Comentario")] Despesa despesa)
    var userId = User.Identity.GetUserId();
    if (ModelState.IsValid)
        db.Entry(despesa).State = EntityState.Modified;
        return RedirectToAction("Index");
    ViewBag.TipoDespesaId = new SelectList(db.TipoDespesas, "TipoDespesaId", "TipoDespesaNome", despesa.TipoDespesaId);
    ViewBag.TipoPagamentoId = new SelectList(db.TipoPagamentos, "TipoPagamentoId", "TipoPagamentoNome", despesa.TipoPagamentoId);
    return View(despesa);

Here I need to edit the row that has the same Id as the despise but in a different db. I need to do 2 edits here. How can I do that?

Related posts

Recent Viewed