public IHttpActionResult add(WeddingDto dto)
        {
            var customerId = uow.Customers.GetAll().Single(x => x.Email == Username).Id;
            var wedding = new Wedding() {
                NumberOfGuests = dto.NumberOfGuests,
                Location = dto.Location,
                NumberOfHours = dto.NumberOfHours,
                CustomerId = customerId,
                Date  = dto.Date,
                Categories = dto.Categories.Select(x => new Category() {  Name = x.Name }).ToList()
            };

            this.repository.Add(wedding);
            this.uow.SaveChanges();
            dto.Id = wedding.Id;

            var context = GlobalHost.ConnectionManager.GetHubContext<WeddingHub>();
            context.Clients.All.onWeddingAdded(new { Data =  dto });
            return Ok(dto);
        }
Ejemplo n.º 2
0
 public void OnWeddingAdded(Wedding wedding)
 {
     Clients.Others.onWeddingAdded(wedding);
 }
 public IHttpActionResult update(WeddingDto dto)
 {
     var wedding = new Wedding() { NumberOfGuests = dto.NumberOfGuests };
     repository.Add(wedding);
     uow.SaveChanges();
     return Ok(wedding);
 }
Ejemplo n.º 4
0
 public void OnIssueAdded(Wedding wedding)
 {
     throw new NotImplementedException();
 }