コード例 #1
0
        public JsonResult Delete(int personId)
        {
            string errorMessage;

            PersonInfoDb.Delete(GetUserId(), personId, out errorMessage);

            if (errorMessage == null)
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public JsonResult GetSingle(int personId)
        {
            string errorMessage;

            PersonInfo person = PersonInfoDb.GetSingle(GetUserId(), personId, out errorMessage);

            if (errorMessage == null)
            {
                return(Json(person, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        public JsonResult Add(PersonInfo person)
        {
            string errorMessage;

            int personId = PersonInfoDb.Add(GetUserId(), person, out errorMessage);

            if (errorMessage == null)
            {
                return(Json(personId, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
        public ActionResult GetAll()
        {
            string errorMessage;

            List <PersonInfo> list = PersonInfoDb.GetAll(GetUserId(), out errorMessage);

            if (errorMessage == null)
            {
                ViewBag.UserName    = GetUserName();
                ViewBag.CreatedDate = GetCreatedDate();
                return(View("AddressBook", list));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #5
0
        public ActionResult GetAll()
        {
            RequestToApplicationUtility.LogRequest(1, string.Format("GetAll (user {0}):&nbsp;", GetUserName()), this.Request.Headers);

            string errorMessage;

            List <PersonInfo> list = PersonInfoDb.GetAll(GetUserId(), out errorMessage);

            if (errorMessage == null)
            {
                ViewBag.UserName    = GetUserName();
                ViewBag.CreatedDate = GetCreatedDate();
                return(View("AddressBook", list));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }