Example #1
0
        public ActionResult _AddGroup(string groupName)
        {
            var lastGroup = _taskService.GetAllGroups()
                            .OrderByDescending(x => x.DisplayOrder)
                            .FirstOrDefault() ?? new tblGroup();

            var group = new tblGroup
            {
                DisplayOrder = lastGroup.DisplayOrder + 1,
                InsertDate   = DateTime.Now,
                InsertUserId = 0,
                Name         = groupName
            };

            try
            {
                _taskService.AddGroup(group);
                _unitOfWork.SaveChanges();
            }
            catch (Exception ex)
            {
                var responseModel = CreateResponse(HttpStatusCode.InternalServerError, ex.GetBaseException().Message, ResponseStatusTypes.Danger);

                return(Json(responseModel, JsonRequestBehavior.AllowGet));
            }

            return(PartialView("_GroupPartial", group));
        }