// GET: Opportunity/Edit/5
        public ActionResult Edit(int id)
        {
            var         o   = op.GetById(id);
            opportunity opp = new opportunity
            {
                description = o.description,
            };

            return(View(o));
        }
Beispiel #2
0
        public async void TestPut()
        {
            using (var client = server.CreateClient().AcceptJson())
            {
                var service = new OpportunityService();
                var item    = service.GetAll().FirstOrDefault();

                if (item == null)
                {
                    this.TestPost();
                    item = service.GetAll().FirstOrDefault();
                }

                var    itemId = item.Id;
                string unique = (Guid.NewGuid()).ToString();

                item.Name = unique;

                var response = await client.PutAsJsonAsync(string.Format("/api/Opportunitys/{0}", itemId), item);

                var result = await response.Content.ReadAsJsonAsync <Opportunity>();

                item = service.GetById(itemId);

                Assert.True(item.Name.Equals(unique, StringComparison.OrdinalIgnoreCase));
                Assert.Equal((int)response.StatusCode, 200);
            }
        }
Beispiel #3
0
        public void TestUpdate()
        {
            ConfigurationHelper.Ensure();

            var service = new OpportunityService();

            var item = service.GetAll().FirstOrDefault();

            if (item == null)
            {
                this.TestAdd();
                item = service.GetAll().FirstOrDefault();
            }

            var    itemId = item.Id;
            string unique = (Guid.NewGuid()).ToString();

            item.Name = unique;
            service.Update(item);

            item = service.GetById(itemId);
            Assert.True(item.Name.Equals(unique, StringComparison.OrdinalIgnoreCase));
        }