public async Task <IActionResult> PutActivityColor(int id, ActivityColor activityColor)
        {
            if (id != activityColor.ActivityColorId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <ActivityColor> > PostActivityColor(ActivityColor activityColor)
        {
            _context.ActivityColor.Add(activityColor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetActivityColor", new { id = activityColor.ActivityColorId }, activityColor));
        }
Exemple #3
0
        public void Run()
        {
            var activityColor = new ActivityColor();

            activityColor.ActivityColorName = "#333333";
            _context.ActivityColor.Add(activityColor);
            _context.SaveChanges();

            var activityStatus = new ActivityStatus();

            activityStatus.ActivityStatusName = "NotDone";
            _context.ActivityStatus.Add(activityStatus);
            _context.SaveChanges();
        }