Exemple #1
0
        public IActionResult AddCollaborator(CollaboratorsModel collaboraters)
        {
            try
            {
                var result = this.collaboratorManager.AddCollaborator(collaboraters);
                if (result == true)
                {
                    return(this.Ok(new ResponseModel <CollaboratorsModel>()
                    {
                        Status = true, Message = "New Collaborator added Successfully !", Data = collaboraters
                    }));
                }

                return(this.BadRequest(new ResponseModel <CollaboratorsModel>()
                {
                    Status = false, Message = "Failed to Add New Collaborator to Database"
                }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new ResponseModel <CollaboratorsModel>()
                {
                    Status = false, Message = ex.Message
                }));
            }
        }
Exemple #2
0
        /// <summary>
        /// Method to Add collaborators to note
        /// </summary>
        /// <param name="collaborators"></param>
        /// <returns>boolean result</returns>
        public bool AddCollaborator(CollaboratorsModel collaborators)
        {
            try
            {
                bool result;
                if (collaborators != null)
                {
                    this.userContext.Collaborators.Add(collaborators);
                    this.userContext.SaveChanges();
                    result = true;
                    return(result);;
                }

                result = false;
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public bool AddCollaborator(CollaboratorsModel collaborator)
        {
            bool result = this.collaborator.AddCollaborator(collaborator);

            return(result);
        }