示例#1
0
        public JsonResult AddGroup(Group group, Inititiative inititiative, Item item)
        {
            bool isSuccess = false;
            TemplateController templateController = new TemplateController();
            Template           template           = null;

            if (inititiative != null || item != null)
            {
                template = templateController.AddTemplateDetails(inititiative, item);

                if (template.Id != 0)
                {
                    group.Template.Id = template.Id;
                    if (groupBL.AddGroup(group))
                    {
                        isSuccess = true;
                    }
                }
            }
            else
            {
                if (groupBL.AddGroup(group))
                {
                    isSuccess = true;
                }
            }

            return(Json(isSuccess));
        }
示例#2
0
        public ActionResult Create([Bind("Name")] GroupInfo group)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    GroupBL.AddGroup(group);

                    //Display confirmation that a group was created and when
                    TempData["custdetails"] = string.Format("The group  \"{0}\"was created, {1}", group.Name, DateTime.Now.ToString("HH:mm MM/dd/yyyy"));
                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }

            return(RedirectToAction(nameof(Index)));
        }
 public Group AddGroup([FromBody] Group group)
 {
     return(GroupBL.AddGroup(group));
 }