예제 #1
0
        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));
        }
예제 #2
0
        // 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);
        }
예제 #3
0
        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));
        }
예제 #4
0
파일: DaoManager.cs 프로젝트: ByronCook/SAM
 public void RegisterDaos()
 {
     UserDao      = new UserDao();
     TeamDao      = new TeamDao();
     ClubDao      = new ClubDao();
     NewsDao      = new NewsDao();
     TeamUserDao  = new TeamUserDao();
     EventDao     = new EventDao();
     AttendantDao = new AttendantDao();
 }
예제 #5
0
 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"
     };
 }
예제 #6
0
        public void GetAllTeams()
        {
            TeamDao teamdao = new TeamDao(database);

            int stat1 = teamdao.FindAll().Count;

            InsertTeams();
            int stat2 = teamdao.FindAll().Count;

            Assert.AreEqual(stat1, stat2 - 1);
        }
예제 #7
0
 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));
 }
예제 #8
0
        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));
        }
예제 #9
0
        public ActionResult Load()
        {
            var data = new TeamDao().load();

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
예제 #10
0
        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));
        }