سلام خدمت دوستان عزیزم ،
چه طوری می تونم یک سطر رو تو Data Base با استفاده از jquery حذف کنم؟
حذف از tabel رو نوشتم ولی از دیتا بیس نمی تونم پاک کنم
@model List<Sms.Core.Entity.Entities.LetterTemplate> @{ ViewBag.Title = "فهرست پیش نویس ها"; Layout = "~/Areas/Client/Views/Layouts/Master.cshtml"; ViewBag.PagePath = new string[] { "مدیریت پیش نویس ها", ViewBag.Title }; } <style type="text/css"> .tooltip-inner, .tooltip { max-width: 350px; white-space: normal; } /*@@media only screen and (max-width: 768px){ .table-responsive-horizontal-xs td { border: none; border-bottom: 1px solid #eee; position: relative; padding-right: 40% !important; white-space: normal; text-align: right; } }*/ </style> <script type="text/javascript"> $(function () { //start delete row in tabel $("a.del").click(function () { var id = $(this).closest('tr').data("id"); $("#delete-dialog").modal('show'); $("#delete-dialog input[name=id]").val(id); console.log(id); }); $("#delete-dialog button[type=submit]").click(function (event) { event.preventDefault(); var id = $(this).closest('form').find("input[name=id]").val() remove(id); }); function remove(id){ $.post("/Client/LetterTemplate/", { id: id }, function (data, status) { //delete row from tabel $("tr#" + id).remove(); // delete from DB //$(id).remove(); $("#delete-dialog").modal('hide'); }); } //End delete row in tabel }); </script> <section class="content"> <div class="row"> <div class="col-xs-8 col-centered" style="width:100%"> <div class="box box-info"> <div class="box-header"> <h3 class="box-title">@ViewBag.Title</h3> </div> <div class="box-body clearfix table-responsive-horizontal-xs"> @Html.Partial("/Areas/Client/Views/Layouts/MessageBox.cshtml") <div class="col-xs-12 clearfix"> <a href="/Client/LetterTemplate/Create" class="btn btn-primary " data-target="#create-dialog">اضافه کردن پیش نویس جدید </a> <br /><br /> @*<a class="btn btn-primary" href="/client/group/index">فرخوانی مجدد</a>*@ </div> <div class="col-xs-12 clearfix"> @if (Model == null || Model.Count == 0) { @Html.Partial("/Areas/Client/Views/Layouts/EmptyBox.cshtml") } else { <table class="table table-bordered table-striped"> <thead> <tr> @*<td class="text-center" style="text-align: right;width:1px;">شناسه</td>*@ <td class="text-center" style="text-align: right;width:440px !important;">عنوان پیش نویس</td> <td class="text-center" style="text-align: right;white-space:pre-line !important;">متن پیامک پیش نویس </td> <td class="text-center" style="text-align: center;width:90px;">عملیات</td> </tr> </thead> <tbody> @foreach (var r in Model) { if (r != null) { <tr id="@r.LTId" data-id="@r.LTId" data-groupname="@r.Title" data-kind="@r.Kind"> @*<td data-title="شناسه" class="number" data-toggle="tooltip" title="@r.Body" data-container="body"> @r.LTId </td>*@ <td data-title="عنوان پیش نویس" class="td-overflow" data-toggle="tooltip" title="@r.Title" data-container="body"> @r.Title </td> <td data-title="متن پیش نویس " class="td-overflow" data-toggle="tooltip" title="@r.Body" data-container="body"> @r.Body </td> <td data-title="عملیات" class="" style="text-align:center;"> <a class="btn btn-xs btn-danger ttip del" data-toggle="tooltip" data-original-title="حذف پیش نویس" data-target="#delete-dialog" href="#" @*href="/Client/LetterTemplate/Delete?id=@r.LTId"*@><i class="fa fa-times"></i></a> <a class="btn btn-xs btn-primary" data-toggle="tooltip" data-original-title="ویرایش پیش نویس" href="/Client/LetterTemplate/Create?id=@r.LTId"><i class="fa fa-edit"></i></a> @*<a class="btn btn-xs btn-success ttip" href="/Client/Message/SendSimple?template=@r.Body" data-toggle="tooltip" data-original-title="ارسال پیام" target="_blank"><i class="fa fa-envelope"></i></a>*@ </td> </tr> } } </tbody> </table> } </div> </div> </div> </div> </div> <!-- Delete Dialog ========================================================================================================--> <div class="modal fade" id="delete-dialog" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <form action="/" method="post" id=""> <input name="id" type="hidden"/> <div class="modal-dialog modal-sm"> <div class="box box-info modal-content"> <div class="box-header"> <div class="box-tools pull-left"> <button class="btn btn-default btn-sm" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> </div> <h3 class="box-title">?</h3> </div> <div class="box-body text-center clearfix"> <span class="message"></span> <h4>آیا مطمن هستید؟</h4> </div> <div class="box-footer text-center clearfix"> <button type="submit" class="btn btn-danger btn-confirm" data-id="delete" data-delete="">بله</button> <button type="submit" class="btn btn-success btn-confirm" data-dismiss="modal" aria-label="Close">خیر</button> </div> <div class="overlay" style="display: none"></div> <div class="loading-img" style="display: none"></div> </div> </div> </form> </div> </section>
این پست در تاریخ {{ dateString(new Date(post.deleteDate)) }} توسط {{ post.deletedByUser }} حذف شده است.
دلیل حذف: {{ post.deleteReason ?? 'نامشخص' }}
زمان پاسخ گویی روز های شنبه الی چهارشنبه ساعت 9 الی 18
فقط به موضوعات مربوط به محصولات آموزشی و فروش پاسخ داده می شود