public async Task <IActionResult> Create(Steplates steplate)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await _steplatesService.CreateAsync(steplate);

            return(Ok(steplate));
        }
        public async Task <IActionResult> Update(string id, Steplates steplate)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var queriedSteplate = await _steplatesService.GetByIdAsync(id);

            if (queriedSteplate == null)
            {
                return(NotFound());
            }

            await _steplatesService.UpdateAsync(id, steplate);

            return(NoContent());
        }
Example #3
0
 public async Task UpdateAsync(string id, Steplates steplate)
 {
     await _steplates.ReplaceOneAsync(s => s.Id == id, steplate);
 }
Example #4
0
        public async Task <Steplates> CreateAsync(Steplates steplate)
        {
            await _steplates.InsertOneAsync(steplate);

            return(steplate);
        }