public void TestEventCRUD()
        {
            IEvent e    = CreateEvent(EventType.Wedding);
            var    ep   = new EventProcessor(e);
            var    save = ep.Create().Result;

            Assert.IsTrue(save.Data != null && save.Data.Id != Guid.Empty, "Event save failed.");

            var one = ep.FetchById().Result;

            Assert.IsTrue(one.Data != null, "Event fetch failed.");

            var delete = ep.Delete().Result;

            one = ep.FetchById().Result;
            Assert.IsTrue(one.Data == null, "Event delete failed.");

            var vp = new VendorProcessor(e.Arrangements[0].Vendor.Id);
            var d  = vp.Delete().Result;
            var o  = vp.FetchById().Result;

            Assert.IsTrue(o.Data == null, "Vendor delete failed.");

            var uHelper = new UserProcessor(e.Arrangements[0].Vendor.Id);
            var uOne    = uHelper.FetchById().Result;

            Assert.IsTrue(uOne.Data == null, "User not deleted from vendor delete.");
        }
Exemple #2
0
        public async Task <HttpResponseMessage> Delete(EventRequest req)
        {
            if (req.Id != Guid.Empty)
            {
                var ep = new EventProcessor(req.Id);
                var e  = await ep.Delete();

                if (e > 0)
                {
                    return(new HttpResponseMessage()
                    {
                        Content = new StringContent(Convert.ToBoolean(e).ToString()),
                        StatusCode = System.Net.HttpStatusCode.OK
                    });
                }
                else
                {
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.NotFound));
                }
            }
            return(new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest));
        }