删除完整日历的事件 [英] Delete event of full calender

查看:132
本文介绍了删除完整日历的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我想删除完整日历的事件,



我有这个:





I want to delete an event of the full calender,

I have this:

$('#btnPopupDelete').click(function () {
           
            
            function DeleteEvent(EventID) {

                var dataRow = {
                    'Id': EventID


                }

                $.ajax({
                    type: 'POST',
                    url: "/Calendar/DeleteEvent",
                    dataType: "json",
                    contentType: "application/json",
                    data: JSON.stringify(dataRow)
                });

            }
        });





这在CalenderController中:





this in the CalenderController:

public bool DeleteEvent(int Id)
       {
           return DiaryEvent.DeleteEvent(Id);
       }





这个在DiaryEvents中:





and this in the DiaryEvents:

public static bool DeleteEvent(int Id)
        {
            try
            {
                LolaBikeContext db = new LolaBikeContext();
                AppointmentDiary diary = db.AppointmentDiarys.Find(Id);
                db.AppointmentDiarys.Remove(diary);
                db.SaveChanges();
            }
            catch (Exception)
            {
                
                throw;
            }


            return true;
        
        
        }





这个按钮:





this the button:

<button type="button" id="btnPopupDelete" data-dismiss="modal" class="btn btn-danger right ">Delete event</button>





但它没有击中控制器



谢谢



But it doesnt hit the Controller

Thank you

推荐答案

' #btnPopupDelete')。click(function(){


function DeleteEvent(EventID){

var dataRow = {
' Id':EventID


}
('#btnPopupDelete').click(function () { function DeleteEvent(EventID) { var dataRow = { 'Id': EventID }


.ajax({
类型:' POST'
url: / Calendar / DeleteEvent
dataType: json
contentType: application / json
data:JSON.stringify(dataRow)
});

}
});
.ajax({ type: 'POST', url: "/Calendar/DeleteEvent", dataType: "json", contentType: "application/json", data: JSON.stringify(dataRow) }); } });





这在CalenderController中:





this in the CalenderController:

public bool DeleteEvent(int Id)
       {
           return DiaryEvent.DeleteEvent(Id);
       }





这个在DiaryEvents中:





and this in the DiaryEvents:

public static bool DeleteEvent(int Id)
        {
            try
            {
                LolaBikeContext db = new LolaBikeContext();
                AppointmentDiary diary = db.AppointmentDiarys.Find(Id);
                db.AppointmentDiarys.Remove(diary);
                db.SaveChanges();
            }
            catch (Exception)
            {
                
                throw;
            }


            return true;
        
        
        }





这个按钮:





this the button:

<button type="button" id="btnPopupDelete" data-dismiss="modal" class="btn btn-danger right ">Delete event</button>





但它没有击中控制器



谢谢



But it doesnt hit the Controller

Thank you






请尝试如下:



Hi

Please try like below:


这篇关于删除完整日历的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆