Beispiel #1
0
        public IActionResult Put(long id, [FromBody] Note note)
        {
            try
            {
                if (note == null)
                {
                    return(BadRequest("Note is null."));
                }

                Note userUpdate = _notesBL.Get(id);
                if (userUpdate == null)
                {
                    return(NotFound("The User record couldn't be found."));
                }

                bool result = _notesBL.Put(userUpdate, note);
                if (result == true)
                {
                    return(this.Ok(new { success = true, message = "Successfully edited" }));
                }
                else
                {
                    return(this.BadRequest(new { success = false, message = "Editing Failed" }));
                }
            }
            catch (Exception ex)
            {
                return(this.BadRequest(new { success = false, message = ex.Message }));
            }
        }