Exemple #1
0
        public AddCompanyViewModel InitFormView([QueryString] int?companyId)
        {
            List <ActivityViewModel> activitiesVM = null;
            List <Activity>          activities   = ActivitiesRepository.GetActivities();

            activitiesVM = Mapper.Map <List <Activity>, List <ActivityViewModel> >(activities);
            AddCompanyViewModel model = null;

            if (companyId.HasValue)
            {
                Company company = CompanyRepository.GetCompanyByID(companyId.Value);
                model = Mapper.Map <Company, AddCompanyViewModel>(company);
            }
            else
            {
                model = new AddCompanyViewModel
                {
                    Name = this.ViewStateCompanyName
                };
            }
            model.Activities = activitiesVM;

            return(model);
        }
 // GET: Activities
 public ActionResult Index()
 {
     return(View(activitiesRepo.GetActivities()));
 }
Exemple #3
0
 public List <Activity> GetActivities()
 {
     return(_repo.GetActivities());
 }