public List<GetAllevents> GetAllEventsForVideoUpload() { var objlist = new List<GetAllevents>(); using (var db = new UnseentalentdbDataContext()) { foreach ( Event item in db.Events.ToList().Where(d => d.IsDeleted == false && d.EventEndDate >= DateTime.Now)) { var objevent = new GetAllevents(); objevent.eventtitle = item.EventTitle; objevent.creatorid = Convert.ToInt64(item.CreatorId); objevent.eventdesc = item.EventDesc; objevent.eventstartdate = Convert.ToString(item.EventStartDate); objevent.eventenddate = Convert.ToString(item.EventEndDate); objevent.isactive = Convert.ToString(item.IsActive); objevent.isdeleted = Convert.ToString(item.IsDeleted); objevent.eventid = item.Id; objevent.eventImage = ReturnImageFullPath(item.EventImage); objlist.Add(objevent); } } return objlist; }
public bool SaveEditEvents(GetAllevents objReq) { bool rst = false; try { using (var db = new UnseentalentdbDataContext()) { var objUser = new CurrentUser(); if (objReq.eventid == 0) { var objNew = new Event(); objNew.CreatorId = objUser.userid; objNew.CreateDate = DateTime.UtcNow; objNew.EventDesc = objReq.eventdesc; objNew.EventTitle = objReq.eventtitle; objNew.EventStartDate = Convert.ToDateTime(objReq.eventstartdate); objNew.EventEndDate = Convert.ToDateTime(objReq.eventstartdate).AddDays(42); objNew.IsActive = true; objNew.IsDeleted = false; db.Events.InsertOnSubmit(objNew); if (!string.IsNullOrWhiteSpace(objReq.eventImage)) objNew.EventImage = objReq.eventImage; db.SubmitChanges(); rst = true; } else { Event evt = db.Events.FirstOrDefault(e => e.Id == objReq.eventid); if (evt != null) { evt.CreateDate = DateTime.UtcNow; evt.EventDesc = objReq.eventdesc; evt.EventTitle = objReq.eventtitle; evt.EventStartDate = Convert.ToDateTime(objReq.eventstartdate); evt.EventEndDate = Convert.ToDateTime(objReq.eventstartdate).AddDays(42); if (!string.IsNullOrWhiteSpace(objReq.eventImage)) evt.EventImage = objReq.eventImage; } db.SubmitChanges(); rst = true; } } } catch { } return rst; }
public Response<bool> SaveEditEvents(GetAllevents objreq) { bool rst = false; var objresponse = new Response<bool>(); var objmethod = new UnseenTalentsMethod(); try { rst = objmethod.SaveEditEvents(objreq); objresponse.Create(true, 0, "Events for admin", rst); } catch (Exception ex) { objresponse.Create(false, -1, "", rst); } return objresponse; }