private PrivilegesViewModel ToViewModel(Application entity)
 {
     return new PrivilegesViewModel
                {
                    ApplicationId = entity.Id,
                    ApplicationName = entity.Name,
                };
 }
        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));
        }
Esempio n. 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
                };
 }
Esempio n. 4
0
 public void Update(Application application)
 {
     Mapper.Map(this, application);
 }
Esempio n. 5
0
 public static EditViewModel Create(Application application)
 {
     return Mapper.Map<EditViewModel>(application);
 }
Esempio n. 6
0
 public static ListItemViewModel Create(Application application)
 {
     return Mapper.Map<ListItemViewModel>(application);
 }
        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
                });
        }