public ActionResult GetListTeam() { IRepositryBase <Fly_Team> repository = new TeamDao(); var vmTeam = new List <Fly_Team>(); try { vmTeam = repository.getAllItems().Where(x => x.Published == true).ToList(); } catch (Exception ex) { return(Json(new { result = ex.Message, Message = ex.Message })); } var rs = vmTeam.Select(x => new { id = x.TeamID, fullname = x.FullName, tagline = x.TagLine, description = x.Description, avatar = x.AvatarURL, facebook = x.Facebook, google = x.Google, twitter = x.Twitter }); return(Json(new { result = rs }, JsonRequestBehavior.AllowGet)); }
// TODO: Remove once mocking framework in place. Temporary for Unit Testing public TeamOverrider() { TeamDao aTeam = new TeamDao(); aTeam.Id = 1; aTeam.TeamName = "ATeam"; aTeam.OwnerId = "Hannibal"; teamsCache.TryAdd(aTeam.Id, aTeam); }
public ActionResult Delete(string ma) { if (!new PermissionAttribute().PermissionAuthorization("Delete", "TEAM")) { return(Json(false, JsonRequestBehavior.AllowGet)); } bool status = new TeamDao().Delete(ma); return(Json(new { status = status }, JsonRequestBehavior.AllowGet)); }
public void RegisterDaos() { UserDao = new UserDao(); TeamDao = new TeamDao(); ClubDao = new ClubDao(); NewsDao = new NewsDao(); TeamUserDao = new TeamUserDao(); EventDao = new EventDao(); AttendantDao = new AttendantDao(); }
public void SetUp() { _database = Substitute.For <IMongoDatabase>(); _collection = Substitute.For <IMongoCollection <Team> >(); _teamDao = new TeamDao(_database, _collection); _team = new Team { Name = "test", Email = "test", ShortName = "test", Tla = "test", CrestUrl = "test", Address = "test", Phone = "test", Colors = "test", Venue = "test" }; }
public void GetAllTeams() { TeamDao teamdao = new TeamDao(database); int stat1 = teamdao.FindAll().Count; InsertTeams(); int stat2 = teamdao.FindAll().Count; Assert.AreEqual(stat1, stat2 - 1); }
public ActionResult Save(TeamModel model) { if (ModelState.IsValid) { bool status = false; if (model.isUpdate) { status = new TeamDao().Update(model); } else { status = new TeamDao().Save(model); } return(Json(new { status = status }, JsonRequestBehavior.AllowGet)); } ViewBag.Dept = new SelectList(new DepartmentDao().load(), "Ma_BP", "Ten_BP"); return(PartialView("_DetailTeam", model)); }
public ActionResult Detail(string ma) { TeamModel model = new TeamModel(); if (!string.IsNullOrWhiteSpace(ma)) { if (!new PermissionAttribute().PermissionAuthorization("Update", "TEAM")) { return(Json(false, JsonRequestBehavior.AllowGet)); } model = new TeamDao().detail(ma); model.isUpdate = true; } else { if (!new PermissionAttribute().PermissionAuthorization("Create", "TEAM")) { return(Json(false, JsonRequestBehavior.AllowGet)); } } ViewBag.Dept = new SelectList(new DepartmentDao().load(), "Ma_BP", "Ten_BP"); return(PartialView("_DetailTeam", model)); }
public ActionResult Load() { var data = new TeamDao().load(); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
public ActionResult LoadTeam(string Ma_BP) { var data = new TeamDao().load().Where(m => m.Ma_BP.Contains(Ma_BP)).ToList(); return(Json(data, JsonRequestBehavior.AllowGet)); }