Ejemplo n.º 1
0
 protected virtual void OnRequestEdit(EventArgs e)
 {
     if (RequestEdit != null)
     {
         RequestEdit.Invoke(this, e);
     }
 }
Ejemplo n.º 2
0
        public IHttpActionResult EditRequest(RequestEdit request)
        {

            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            var service = CreateRequestService();

            if (!service.UpdateRequest(request))
                return InternalServerError();

            return Ok();
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            var service = CreateRequestService();
            var detail  = service.GetRequestById(id);
            var model   =
                new RequestEdit
            {
                RequestId = detail.RequestId,
                Content   = detail.Content
            };

            return(View(model));
        }
Ejemplo n.º 4
0
        public bool UpdateRequest(RequestEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Requests
                    .Single(e => e.RequestId == model.RequestId && e.OwnerId == _userId);

                entity.RequestId = model.RequestId;
                entity.Content   = model.Content;

                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 5
0
        public ActionResult Edit(int id, RequestEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.RequestId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = CreateRequestService();

            if (service.UpdateRequest(model))
            {
                TempData["SaveResult"] = "Your request has been updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your request could not be updated.");
            return(View(model));
        }
Ejemplo n.º 6
0
 private void editHands_Click(object sender, RoutedEventArgs e)
 {
     // Your logic
     RequestEdit?.Invoke("sample parameter");
 }