Exemple #1
0
        public async Task <IActionResult> PutGoalProperty(int id, [FromForm] GoalProperty goalProperty)
        {
            if (id != goalProperty.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <GoalProperty> > PostGoalProperty([FromForm] GoalProperty goalProperty)
        {
            _context.GoalProperty.Add(goalProperty);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGoalProperty", new { id = goalProperty.ID }, goalProperty));
        }
 set => SetValue(GoalProperty, value);