public IViewComponentResult Invoke(string title)
        {
            ViewBag.Title = title;
            var s = new SOC();
            s.Init();
            ViewBag.newSoc = s;

            return View(_query.GetList());
        }
Exemple #2
0
        public void AddOrUpdateSoc(SOC soc, Action<Guid> processor)
        {
            Guid theId;
            if (soc.AggregateId==Guid.Empty)
            {
                soc.Init();
                soc.AggregateId = Guid.NewGuid();
                var stream = new List<SOC>();
                stream.Add(soc);
                aggregates.Add(soc.AggregateId, stream);
                theId = soc.Id;
            }
            else
            {
                List<SOC> stream=new List<SOC>();
                if (aggregates.TryGetValue(soc.AggregateId, out stream))
                {
                    SOC newSoc = new SOC()
                    {
                        AggregateId = soc.AggregateId,
                        CreateTime = soc.CreateTime,
                        Description = soc.Description,
                        Id = Guid.NewGuid(),
                        Observation = soc.Observation,
                        Titel = soc.Titel,
                        UpDateTime = DateTime.Now,
                        Version = ++soc.Version
                    };

                    stream.Add(newSoc);
                    theId = newSoc.Id;
                }
                else
                {
                    throw new Exception("Unknown SOC");
                }
            }
            processor.Invoke(theId);
        }