Beispiel #1
0
        public async Task <NoteResponse> IsPin(IsPinModel isPin, int noteID, string userID)
        {
            try
            {
                var note = this.authenticationContext.Note.Where(s => s.UserID == userID && s.NoteID == noteID).FirstOrDefault();
                //check whether data is null or not
                if (note != null)
                {
                    note.IsTrash      = isPin.isPin;
                    note.ModifiedDate = DateTime.Now;
                    this.authenticationContext.Note.Update(note);
                    await this.authenticationContext.SaveChangesAsync();

                    NoteResponse data = this.GetNoteResponse(userID, note);
                    return(data);
                }
                else
                {
                    throw new Exception("Matching Data Not found");
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Beispiel #2
0
        public async Task <IActionResult> IsPin(IsPinModel isPin, int noteID)
        {
            try
            {
                var userID = HttpContext.User.Claims.First(c => c.Type == "UserID").Value;
                var data   = await this.noteBL.IsPin(isPin, noteID, userID);

                bool success = false;
                var  message = string.Empty;
                if (data != null)
                {
                    success = true;
                    message = "note is Updated";
                    return(this.Ok(new { success, message }));
                }
                else
                {
                    success = false;
                    message = "Note is not updated";
                    return(this.BadRequest(new { success, message }));
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Beispiel #3
0
 public async Task <NoteResponse> IsPin(IsPinModel ispin, int noteID, string userID)
 {
     try
     {
         if (userID != null)
         {
             return(await this.noteRL.IsPin(ispin, noteID, userID));
         }
         else
         {
             throw new Exception("User not found");
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }