コード例 #1
0
        public MissionView(Mission model)
        {
            Mapper.CreateMap<Mission, MissionView>();
            Mapper.Map<Mission, MissionView>(model, this);

            this.created = model.created.ToString().Replace('T', ' ');
            this.updated = model.updated.ToString().Replace('T', ' ');
            this.date = model.date == null ? String.Empty : model.date.ToString();
            this.categoryIds = model.categories.Select(c => c.id).ToArray();
        }
コード例 #2
0
 public Mission createMission(Mission model)
 {
     db.missions.Add(model);
     db.SaveChanges();
     return model;
 }
コード例 #3
0
        public Mission getModel(IRepository repo)
        {
            var model = new Mission();

            Mapper.CreateMap<MissionView, Mission>();
            Mapper.Map<MissionView, Mission>(this, model);

            if (this.customerId != null) { model.customer = repo.getCustomer((int)this.customerId); }
            if (this.categoryIds.Length > 0) { model.categories = repo.getCategories(this.categoryIds).ToArray(); }

            return model;
        }