Ignore:
Timestamp:
08/29/24 20:27:21 (3 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
99d0ecc
Parents:
a850333
Message:

fix issues

fix bugs with nested tables
fix delete nested fk items

File:
1 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/BlogPostAnswersController.cs

    ra850333 re90ba32  
    155155        public ActionResult Edit([Bind(include: "id,parent_id,reply,root_post,usersID")] BlogPostAnswers answerClass)
    156156        {
    157             if (ModelState.IsValid)
    158             {
    159                 db.Entry(answerClass).State = EntityState.Modified;
     157
     158            BlogPostAnswers answerClassDB = db.BlogPostAnswersObj.Find(answerClass.id);
     159            if (answerClassDB != null && !answerClassDB.reply.Equals(answerClass.reply))
     160            {
     161                answerClassDB.reply = answerClass.reply;
     162                answerClassDB.parent_id = answerClass.parent_id;
     163                db.Entry(answerClassDB).State = EntityState.Modified;
    160164                db.SaveChanges();
    161                 return RedirectToAction("Index");
    162             }
    163             return View(answerClass);
     165                //return RedirectToAction("Index");
     166                int id = answerClassDB.BlogPostConsultationid;
     167                return RedirectToAction("Details", "Blog", new { id });
     168            }
     169            return View(answerClassDB);
    164170        }
    165171
Note: See TracChangeset for help on using the changeset viewer.