Exemplo n.º 1
0
        public ActionResult Delete(CalendarCellEventVm calendarEvent)
        {
            try
            {
                _service.Delete(calendarEvent);
            }
            catch (WarningException exception)
            {
                ModelState.AddModelError("", exception.Message);
            }

            return Json(new {});
        }
Exemplo n.º 2
0
        public ActionResult Create(CalendarCellEventVm calendarEvent)
        {
            int id = 0;

            try
            {
                id = _service.Save(calendarEvent, User.Identity.Name);
            }
            catch (WarningException exception)
            {
                ModelState.AddModelError("", exception.Message);
            }

            return Json(new { id = id});
        }
Exemplo n.º 3
0
        public void Delete(CalendarCellEventVm calendarEvent)
        {
            if(calendarEvent.EventType == EventType.Personal)
            {
                var toDelete = _unit.PersonalEvent.Get(l => l.Event.Id == calendarEvent.Id);

                if(toDelete != null)
                {
                    _unit.PersonalEvent.Delete(toDelete);
                }
            }
            else
            {
                var toDelete = _unit.TeamEvent.Get(l => l.Event.Id == calendarEvent.Id);

                if (toDelete != null)
                {
                    _unit.TeamEvent.Delete(toDelete);
                }
            }
        }
Exemplo n.º 4
0
        public int Save(CalendarCellEventVm calendarEvent, string currentUserEmail)
        {
            var currentUser = _unit.User.Get(user => user.Email == currentUserEmail);
            if(currentUser != null)
            {
                return _savingService.Save(new CalendarEventVm(calendarEvent.Map()), currentUser.Id);
            }

            return 0;
        }