Esempio n. 1
0
        public JsonResult SaveBroadcastMessage(Broadcast_Message messageObj)
        {
            var message = "";

            if (String.IsNullOrEmpty(messageObj.UserId))
            {
                message = "Please provide userId";
                return(new JsonResult
                {
                    Data = message,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }

            messageObj.CreatedDate = DateTime.Now;
            try
            {
                _services.Save(messageObj);
                _services.SaveChanges();
                message = "Message Saved Successfully";
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(new JsonResult
            {
                Data = message,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
 public IHttpActionResult SaveBroadcastMessage(Broadcast_Message messageObj)
 {
     return(Ok(_services.SaveBroadcastMessage(messageObj).Data));
 }