public HttpResponseMessage Save(VendorState vnd) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created); try { vnd.CurUserAdSid = GetCurUser().Sid; vnd.Save(); response.Content = new StringContent(String.Format("{{\"id\":{0}}}", vnd.Id)); } catch (Exception ex) { response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex)); } return response; }
public HttpResponseMessage SetDeliverySent(VendorState[] vendorStates, byte deliveryType) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created); byte expires = (byte) (deliveryType == 2 ? 1 : 0); byte newbie = (byte)(deliveryType == 0 ? 1 : 0); byte updated = (byte)(deliveryType == 1 ? 1 : 0); try { foreach (VendorState vendorState in vendorStates) { VendorState.SetDeliverySent(vendorState.Id, expires, newbie, updated); } } catch (Exception ex) { response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex)); } return response; }