public async Task <IActionResult> PutEventRepetition([FromRoute] int id, [FromBody] EventRepetition eventRepetition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eventRepetition.Id)
            {
                return(BadRequest());
            }

            _context.Entry(eventRepetition).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventRepetitionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        CalendarEvent getCalEventByOrginalStart(DateTimeOffset OrginalStartData)
        {
            CalendarEvent RetValue = this;

            if (EventRepetition.Enable)
            {
                RetValue = EventRepetition.getCalendarEventByOriginalStart(OrginalStartData);
            }
            return(RetValue);
        }
        public async Task <IActionResult> PostEventRepetition([FromBody] EventRepetition eventRepetition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.EventRepetitions.Add(eventRepetition);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEventRepetition", new { id = eventRepetition.Id }, eventRepetition));
        }