Ejemplo n.º 1
0
 /// <summary>
 /// Create a new TblGroup object.
 /// </summary>
 /// <param name="groupId">Initial value of the GroupId property.</param>
 /// <param name="groupName">Initial value of the GroupName property.</param>
 public static TblGroup CreateTblGroup(global::System.Int32 groupId, global::System.String groupName)
 {
     TblGroup tblGroup = new TblGroup();
     tblGroup.GroupId = groupId;
     tblGroup.GroupName = groupName;
     return tblGroup;
 }
        public ActionResult Save(GroupViewModel groupViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //add
                    if (groupViewModel.GroupId == 0 && groupViewModel.ActionName == "Add")
                    {
                        var model = new TblGroup()
                        {
                            GroupId = groupViewModel.GroupId,
                            GroupName = groupViewModel.GroupName,
                            Description = groupViewModel.Description,
                            //ApplicationId = groupViewModel.ApplicationId,
                            //ModuleId = groupViewModel.ModuleId
                        };

                        //_groupRepository.Insert(model);
                        //add role to group wise
                    }
                    else if (groupViewModel.ActionName == "Edit") //edit
                    {
                        TblGroup group = _groupRepository.GetById(groupViewModel.GroupId);

                        if (group != null)
                        {

                            group.GroupId = groupViewModel.GroupId;
                            group.GroupName = groupViewModel.GroupName;
                            group.Description = groupViewModel.Description;

                            //group.ApplicationId = groupViewModel.ApplicationId;
                            //group.ModuleId = groupViewModel.ModuleId;

                            //_groupRepository.Update(group);

                        }
                        else
                        {
                            return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, groupViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageForNullObject()));
                        }

                    }

                    //_groupRepository.Save();

                    return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, groupViewModel.ActionName, MessageType.success.ToString(), "Saved Successfully."));

                }

                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, groupViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, groupViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageFormat(ex)));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TblGroups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTblGroups(TblGroup tblGroup)
 {
     base.AddObject("TblGroups", tblGroup);
 }