示例#1
0
        public async Task <IActionResult> AddLectureDetail(LectureDetail ldetail)
        {
            int upt = 0;

            try
            {
                Method.CrtFill(ldetail, HttpContext.Session.GetInt32("userid") ?? 1, DateTime.Now, HttpContext.Connection.RemoteIpAddress.ToString());

                repo.Add(ldetail);
                await repo.SaveAll();
            }
            catch
            {
            }

            return(Ok(ldetail.Id));
        }
示例#2
0
        public async Task <IActionResult> EditLectureDetail(LectureDetail ldetail)
        {
            int upt = 0;

            try
            {
                repo.Update(ldetail);
                if (await repo.SaveAll())
                {
                    upt = 1;
                }
            }
            catch
            {
                upt = 2;
            }

            return(Ok(upt));
        }
示例#3
0
        public async Task <IActionResult> DeleteLectureDetail(int id)
        {
            var msg     = 0;
            var ldetail = new LectureDetail()
            {
                Id = id
            };

            try
            {
                db.Attach(ldetail);
                db.Remove(ldetail);
                if (await db.SaveChangesAsync() > 0)
                {
                    msg = 1;
                }
            }
            catch
            {
            }

            return(Ok(msg));
        }