コード例 #1
0
 public ActionResult Create(int profileId)
 {
     var intervalCreate = new IntervalCreate
     {
         ProfileId = profileId
     };
     return PartialView(intervalCreate);
 }
コード例 #2
0
        public ActionResult Create(IntervalCreate intervalView)
        {
            if (ModelState.IsValid)
            {
                var interval = new Interval
                {
                    Description = intervalView.Description,
                    End = intervalView.End,
                    Start = intervalView.Start,
                    ProfileId = intervalView.ProfileId
                };

                _uow.IntervalRepository.Insert(interval);
                _uow.Save();

                string url = Url.Action("Index", "Interval", new { id = intervalView.ProfileId });
                return Json(new { success = true, url = url });
            }

            return PartialView(intervalView);
        }
コード例 #3
0
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var interval = _uow.IntervalRepository.GetById(id);

            if (interval == null)
            {
                return HttpNotFound();
            }

            var intervalVirew = new IntervalCreate
                {
                    Start = interval.Start,
                    End = interval.End,
                    Description = interval.Description,
                    Id = interval.Id,
                    ProfileId = interval.ProfileId
                };

            return PartialView(intervalVirew);
        }