void CreateBizMsg(BizMsg bizMsg)
        {
            var id = _bizMsgCoreService.Insert(bizMsg);

            var ctx = WebOperationContext.Current.OutgoingResponse;
            ctx.StatusCode = System.Net.HttpStatusCode.Created;

            // Set the Http Location Header
            HttpResponseHeader locationHeader = HttpResponseHeader.Location;
            string locationValue = WebOperationContext.Current.IncomingRequest.GetRequestUri() + id.ToString();
            ctx.Headers.Add(locationHeader, locationValue);
        }
        void UpdateBizMsg(string id, BizMsg bizMsg)
        {
            var bizMsgToUpd = _bizMsgCoreService.GetById(int.Parse(id));

            bizMsgToUpd.Name = bizMsg.Name;
            bizMsgToUpd.Date = bizMsg.Date;
            bizMsgToUpd.User = bizMsg.User;

            bizMsgToUpd.Description = bizMsg.Description;
            bizMsgToUpd.AppId = bizMsg.AppId;
            bizMsgToUpd.ServiceId = bizMsg.ServiceId;
            bizMsgToUpd.StyleId = bizMsg.StyleId;
            bizMsgToUpd.Roles = bizMsg.Roles;

            var updId = _bizMsgCoreService.Update(bizMsgToUpd);

            OutgoingWebResponseContext ctx = WebOperationContext.Current.OutgoingResponse;
            ctx.StatusCode = System.Net.HttpStatusCode.Accepted;

            // Set the Http Location Header
            HttpResponseHeader locationHeader = HttpResponseHeader.Location;
            string locationValue = WebOperationContext.Current.IncomingRequest.GetRequestUri() + id.ToString();
            ctx.Headers.Add(locationHeader, locationValue);
        }
예제 #3
0
 public static void Send(BizMsg bizMsg)
 {
     var context = GlobalHost.ConnectionManager.GetHubContext<Chat>();
     string json = JsonConvert.SerializeObject(bizMsg);
     context.Clients.addMessageEx(json);
 }