コード例 #1
0
 public Admin GetAdminInfo(int adminId)
 {
     //// 136 TODO: get the admin info
     //// for now, returning the hard-coded value
     var errors = new List<string>();
     var repository = new AdminRepository();
     var service = new AdminService(repository);
     return service.GetAdmin(adminId, ref errors);
 }
コード例 #2
0
        public string InsertAdmin(Admin admin)
        {
            var errors = new List<string>();
            var repository = new AdminRepository();
            var service = new AdminService(repository);
            service.InsertAdmin(admin, ref errors);
            if (errors.Count == 0)
            {
                return "ok";
            }

            return "error";
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: fastily/cse136
        public string UpdateAdminInfo(Admin admin)
        {
            var errors = new List<string>();
            var repository = new AdminRepository(this.entities);
            var service = new AdminService(repository);
            service.UpdateAdmin(admin, ref errors);

            if (errors.Count == 0)
            {
                return "Update Successful";
            }

            return "error";
        }
コード例 #4
0
        public string DeleteStudent(string id)
        {
            var errors = new List<string>();
            var repository = new AdminRepository();
            var service = new AdminService(repository);
            service.DeleteAdmin(id, ref errors);

            if (errors.Count == 0)
            {
                return "ok";
            }

            return "error";
        }
コード例 #5
0
ファイル: AdminController.cs プロジェクト: fastily/cse136
        public Admin GetAdminInfo(int adminId)
        {
            var errors = new List<string>();
            var repository = new AdminRepository(this.entities);
            var service = new AdminService(repository);
            var adminPoco = service.GetAdminById(adminId, ref errors);

            if (errors.Count == 0 && adminPoco != null)
            {
                return adminPoco;
            }

            return new Admin();
        }