Ejemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TblRights EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTblRights(TblRight tblRight)
 {
     base.AddObject("TblRights", tblRight);
 }
Ejemplo n.º 2
0
        public ActionResult Save(RightViewModel rightViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //add
                    if (rightViewModel.RightId == 0 && rightViewModel.ActionName == "Add")
                    {
                        var model = new TblRight()
                        {
                            RightId = rightViewModel.RightId,
                            RightName = rightViewModel.RightName,
                            RightTitle = rightViewModel.RightTitle,
                            Description = rightViewModel.Description,
                            ApplicationId = rightViewModel.ApplicationId,
                            ModuleId = rightViewModel.ModuleId
                        };

                        _rightRepository.Insert(model);
                    }
                    else if (rightViewModel.ActionName == "Edit") //edit
                    {
                        TblRight right = _rightRepository.GetById(rightViewModel.RightId);

                        if (right != null)
                        {

                            right.RightId = rightViewModel.RightId;
                            right.RightName = rightViewModel.RightName;
                            right.RightTitle = rightViewModel.RightTitle;
                            right.Description = rightViewModel.Description;

                            right.ApplicationId = rightViewModel.ApplicationId;
                            right.ModuleId = rightViewModel.ModuleId;

                            _rightRepository.Update(right);

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

                    }

                    _rightRepository.Save();

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

                }

                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, rightViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, rightViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageFormat(ex)));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new TblRight object.
 /// </summary>
 /// <param name="rightId">Initial value of the RightId property.</param>
 /// <param name="rightTitle">Initial value of the RightTitle property.</param>
 public static TblRight CreateTblRight(global::System.Int32 rightId, global::System.String rightTitle)
 {
     TblRight tblRight = new TblRight();
     tblRight.RightId = rightId;
     tblRight.RightTitle = rightTitle;
     return tblRight;
 }