Beispiel #1
0
 public async Task <IActionResult> Create([Bind("Id,Name,Private,GroupCategory,IconPath")] GroupDescription groupDescription)
 {
     if (ModelState.IsValid)
     {
         _db.Create(groupDescription);
         _db.Save();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["GroupCategory"] = new SelectList(_db.GetCategories(), "Id", "Name", groupDescription.GroupCategory);
     return(View(groupDescription));
 }
Beispiel #2
0
        public bool EditGroupInfo(GroupDescription model)
        {
            GroupDescription group = _groupRepo.GetElement(model.Id);
            var elem = _groupRepo.GetElementByName(model.Name);

            if (elem == null)
            {
                group.Name = model.Name;
            }
            else if (model.Name != group.Name)
            {
                return(false);
            }

            group.Private = model.Private;
            _groupRepo.Update(group);
            _groupRepo.Save();
            return(true);
        }