Example #1
0
        public IHttpActionResult Post([FromBody] LiveHostShow show)
        {
            if (ModelState.IsValid)
            {
                var uid = User.Identity.GetUserId();

                if (_reps.Exist(uid))
                {
                }
                show.Id      = _reps.GenNewId();
                show.MakeDay = DateTime.Now;
                show.UserId  = uid;
                _reps.Add(show);
            }
            return(Ok(show.Id));
        }
Example #2
0
        public ActionResult UpdateOrAdd(LiveHostShow hostShow)
        {
            int i = 0;

            if (ModelState.IsValid)
            {
                hostShow.UserId = User.Identity.Name;
                var d = _hostSv.Single(hostShow.UserId);
                if (d != null)
                {
                    d.IsBasic      = hostShow.IsBasic;
                    d.StartDate    = hostShow.StartDate;
                    d.TimeDuration = hostShow.TimeDuration;
                    d.MakeDay      = DateTime.Now;
                    i = _hostSv.Update(d);
                }
                else
                {
                    i = _hostSv.Add(hostShow);
                }
            }

            return(Json(new { i }, JsonRequestBehavior.AllowGet));
        }