public async Task <bool> AddNoteLabel(AddNoteLabelRequest model, int userId, int NoteId) { try { SqlConnection connection = DBConnection(); SqlCommand command = StoreProcedureConnection("spAddNoteLabel", connection); command.Parameters.AddWithValue("UserId", userId); command.Parameters.AddWithValue("NoteId", NoteId); command.Parameters.AddWithValue("LabelId", model.LabelId); command.Parameters.AddWithValue("LabelName", model.LabelName); command.Parameters.AddWithValue("CreatedDATETime", DateTime.Now); command.Parameters.AddWithValue("ModifiedDateTime", DateTime.Now); connection.Open(); int result = await command.ExecuteNonQueryAsync(); connection.Close(); if (result > 0) { return(true); } else { return(false); }; } catch (Exception e) { throw e; } }
public async Task <IActionResult> AddNoteLabel(AddNoteLabelRequest model, int NoteId) { try { if (model != null) { var userId = TokenUserId(); if (await note.AddNoteLabel(model, userId, NoteId)) { return(Ok(new { success = true, Message = "Label added" })); } else { return(BadRequest(new { success = false, Message = "Label did not added" })); } } else { return(BadRequest(new { success = false, Message = "Input should not be empty!!!" })); } } catch (Exception e) { return(BadRequest(new { success = false, e.Message })); } }
public async Task <bool> AddNoteLabel(AddNoteLabelRequest model, int userId, int NoteId) { try { return(await notes.AddNoteLabel(model, userId, NoteId)); } catch (Exception e) { throw e; } }