public ResponseModel SaveclubEvent(ClubModel model) { ResponseModel _respnse = new ResponseModel(); ShomaRMEntities db = new ShomaRMEntities(); if (db.tbl_Club.Where(a => a.ClubTitle.ToLower() == model.ClubTitle.ToLower()).ToList().Count() == 0) { var ClubCreate = new tbl_Club() { Id = model.Id, ClubTitle = model.ClubTitle, ActivityId = model.ActivityId, StartDate = model.StartDate, Venue = model.Venue, DayId = model.DayId, Time = model.Time, Contact = model.Contact, Email = model.Email, PhoneNumber = model.PhoneNumber, PhoneCheck = model.PhoneCheck, EmailCheck = model.EmailCheck, LevelId = model.LevelId, SpecialInstruction = model.SpecialInstruction, Description = model.Description, BriefDescription = model.BriefDescription, TermsAndCondition = model.TermsAndCondition, TenantID = model.TenantID, UserId = model.UserId, IsDeleted = false, Active = true, CreatedDate = DateTime.UtcNow, LastUpdatedDate = DateTime.UtcNow }; db.tbl_Club.Add(ClubCreate); db.SaveChanges(); var CreateClubMap = new tbl_ClubMapping() { Id = 0, ClubId = ClubCreate.Id, UserId = model.UserId }; db.tbl_ClubMapping.Add(CreateClubMap); db.SaveChanges(); _respnse.Status = true; _respnse.msg = "Saved Successfully.."; } else { _respnse.Status = false; _respnse.msg = "You Already Registered For This Event"; } db.Dispose(); return(_respnse); }
public ResponseModel EditclubEvent(ClubModel model) { ResponseModel _respnse = new ResponseModel(); ShomaRMEntities db = new ShomaRMEntities(); try { if (db.tbl_Club.Where(a => a.Id == model.Id).FirstOrDefault().ClubTitle.ToLower() == model.ClubTitle.ToLower()) { var club = db.tbl_Club.Where(a => a.Id == model.Id).FirstOrDefault(); club.Id = model.Id; club.ClubTitle = model.ClubTitle; club.ActivityId = model.ActivityId; club.StartDate = model.StartDate; club.Venue = model.Venue; club.DayId = model.DayId; club.Time = model.Time; club.Contact = model.Contact; club.Email = model.Email; club.PhoneNumber = model.PhoneNumber; club.PhoneCheck = model.PhoneCheck; club.EmailCheck = model.EmailCheck; club.LevelId = model.LevelId; club.SpecialInstruction = model.SpecialInstruction; club.Description = model.Description; club.BriefDescription = model.BriefDescription; club.TermsAndCondition = model.TermsAndCondition; club.TenantID = model.TenantID; club.UserId = model.UserId; club.CreatedDate = DateTime.UtcNow; club.LastUpdatedDate = DateTime.UtcNow; db.Entry(club).State = EntityState.Modified; db.SaveChanges(); _respnse.Status = true; _respnse.msg = "Update Successfully.."; } else { _respnse.Status = false; _respnse.msg = "Club Not Found.."; } } catch (Exception ex) { _respnse.Status = false; _respnse.msg = ex.ToString(); } db.Dispose(); return(_respnse); }
public CommonClubModel() { _ClubModel = new ClubModel(); _clublist = new List <ClubModel>(); }