public bool InsertOfflineChatDetails(ChatOfflineMessageDetails details)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@senderId", Value = details.SenderId, SqlDbType = SqlDbType.BigInt
                },
                new SqlParameter()
                {
                    ParameterName = "@recieverId", Value = details.RecieverId, SqlDbType = SqlDbType.BigInt
                },
                new SqlParameter()
                {
                    ParameterName = "@textMessage", Value = details.TextMessage == null?(object)DBNull.Value:details.TextMessage, SqlDbType = SqlDbType.VarChar
                },
                new SqlParameter()
                {
                    ParameterName = "@imageUrl", Value = details.ImageUrl == null?(object)DBNull.Value:details.ImageUrl, SqlDbType = SqlDbType.VarChar
                },
                new SqlParameter()
                {
                    ParameterName = "@videoUrl", Value = details.VideoUrl == null?(object)DBNull.Value:details.VideoUrl, SqlDbType = SqlDbType.VarChar
                },
            };

            object[] parameters = sp.ToArray();
            var      users      = _offlineChatReposiotory.ExecuteStoredProcedureList <AuthUser>(PROC_INSERT_OFFLINE_MESSAGE_DETAILS, parameters);

            if (users != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public IHttpActionResult InsertOfflineChatMessages(OfflineChatModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Sender Id and Reciever Id are required.")));
                }

                ChatOfflineMessageDetails details = new ChatOfflineMessageDetails();
                details.ImageUrl    = model.image;
                details.RecieverId  = model.recieverId;
                details.SenderId    = model.senderId;
                details.TextMessage = model.message;
                details.VideoUrl    = model.video;
                _chatOfflineService.InsertOfflineChatDetails(details);
            }
            catch (Exception e)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message)));
            }

            return(Ok("Message details inserted successfully."));
        }