// GET: Admin public ActionResult Index() { //List<ApplicationUser> list = _context.Users.Select(x => new ApplicationUser { UserName = x.UserName, Email = x.Email, PhoneNumber = x.PhoneNumber, Id = x.Id }).ToList(); //ViewBag.UserList = list; ViewBag.DepartmentCount = _dtservice.GetDepartments().Count(); ViewBag.EventCount = _event.GetEvents().Count(); ViewBag.SermonCount = _sermonServices.GetSermons().Count(); ViewBag.WorkerCount = _workServ.GetWorkers().Count(); ViewBag.MemberCount = _memberServices.GetMembers().Count(); return(View()); }
// GET: Sermon public ActionResult Index() { var sermon = _sermonServices.GetSermons().OrderBy(n => n.SermonDate); ViewBag.SermonCategory = _context.SermonCategories.ToList().Select(r => new SermonCategoryModel(r) { SermonDescription = r.SermonDescription, SermonName = r.SermonName }); var sermonCat = _context.SermonCategories.ToList(); var svm = new SermonViewModel { Sermons = sermon, SermonCategorss = sermonCat, SermonCat = "" }; return(View(svm)); }
public HttpResponseMessage AddSermon([FromBody] SermonModel s) { IEnumerable <SermonModel> sermon = _sermonServices.GetSermons(); var checksermon = sermon.FirstOrDefault(se => se.SermonTitle == s.SermonTitle); if (checksermon != null) { return(this.Request.CreateResponse(HttpStatusCode.Conflict, "Sermon with the title exist ")); } var model = s.Create(s); _context.Sermons.Add(model); _context.SaveChanges(); return(this.Request.CreateResponse(HttpStatusCode.Created, "Successful")); }