コード例 #1
0
        public ActionResult SendBorrowRequest(int itemId)
        {
            int userID      = GetUserID();
            var requestorID = Convert.ToInt32(userID);

            var viewModel = new RequestViewModel();

            viewModel.Requester    = _userService.GetUserByID(requestorID);
            viewModel.Requester_ID = requestorID;
            viewModel.Item         = _itemService.GetItemByID(itemId);
            viewModel.Item_ID      = itemId;


            var data = Mapper.Map <RequestViewModel, Request>(viewModel);

            _requestService.AddItemBorrowRequest(data);

            return(Json("Success"));
        }