Ejemplo n.º 1
0
        public ActionResult Create()
        {
            if (this.Request.IsAjaxRequest() == false) return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var account = this.HttpContext.Account();
            var newChannel = new Channel { Name = Localize.NoTitle };
            newChannel.ChannelMembers.Add(new ChannelMember
            {
                AccountId = account.Id,
                IsOwner = true
            });

            var db = this.DB();
            db.Channels.Add(newChannel);
            db.SaveChanges();

            return Json(new ChannelItemViewModel(newChannel, Url, account));
        }
Ejemplo n.º 2
0
        public ActionResult EditChannelName(Guid id, Channel model)
        {
            if (ModelState.IsValid == false) return View(model);

            var channel = this.DB().Channels.Find(id);
            channel.Name = model.Name;
            this.DB().SaveChanges();

            return RedirectToAction("Settings", new { id });
        }