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)); }
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)); }
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)); }