コード例 #1
0
 private PrivilegesViewModel ToViewModel(Application entity)
 {
     return new PrivilegesViewModel
                {
                    ApplicationId = entity.Id,
                    ApplicationName = entity.Name,
                };
 }
コード例 #2
0
        public void AllowsToSaveNewApplication()
        {
            var app = new Application
                          {
                              Name = "My Sample App",
                              LoggingRules = "SOME RULE"
                          };
            DomainContext.Applications.Save(app);

            var app2 = DomainContext.Applications.Get(app.Id.ToString());
            Assert.That(app.Id, Is.EqualTo(app2.Id));
            Assert.That(app.Name, Is.EqualTo(app2.Name));
        }
コード例 #3
0
 private static SelectListItem Create(ActivityQuery query, Application x)
 {
     return new SelectListItem
                {
                    Selected = query.ApplicationId != null && x.Id == query.ApplicationId,
                    Text = x.Name,
                    Value = x.Id
                };
 }
コード例 #4
0
ファイル: EditViewModel.cs プロジェクト: ByteCarrot/Masslog
 public void Update(Application application)
 {
     Mapper.Map(this, application);
 }
コード例 #5
0
ファイル: EditViewModel.cs プロジェクト: ByteCarrot/Masslog
 public static EditViewModel Create(Application application)
 {
     return Mapper.Map<EditViewModel>(application);
 }
コード例 #6
0
 public static ListItemViewModel Create(Application application)
 {
     return Mapper.Map<ListItemViewModel>(application);
 }
コード例 #7
0
        public void Initialize()
        {
            _manager.Drop();

            // Applications
            var application1 =
                new Application
                    {
                        Id = "514093925daf2e352cb438be",
                        Name = "Masslog Web Interface",
                        LoggingRules = Rule.Default
                    };
            _context.Applications.Save(application1);

            var application2 =
                new Application
                    {
                        Id = "514210a15daf2e2354c80820",
                        Name = "ASP.NET MVC 4 Web Application",
                        LoggingRules = Rule.Default
                    };
            _context.Applications.Save(application2);

            var application3 =
                new Application
                {
                    Id = "517046945daf2e05d03e0a20",
                    Name = "ASP.NET Web Api",
                    LoggingRules = Rule.Default
                };
            _context.Applications.Save(application3);

            // Users
            _context.Users.Save(
                new User
                    {
                        Id = "514093925daf2e352cb438bc",
                        Username = "******",
                        Password = "******",
                        Email = "*****@*****.**",
                        IsAdministrator = true
                    });

            _context.Users.Save(
                new User
                    {
                        Id = "514093925daf2e352cb438bd",
                        Username = "******",
                        Password = "******",
                        Email = "*****@*****.**",
                        IsAdministrator = false,
                        Privileges = new List<Privileges>
                                         {
                                             new Privileges { ApplicationId = application1.Id, CanModify = false },
                                         }
                    });

            _context.Users.Save(
                new User
                {
                    Id = "514093925daf2e352cb438be",
                    Username = "******",
                    Password = "******",
                    Email = "*****@*****.**",
                    IsAdministrator = false
                });
        }