﻿@model IEnumerable<MMLibrarySystem.Models.BorrowRecord>

@{
    ViewBag.Title = "Borrowed Books";
}

<table id="bookList">
    <tr>
        <td>
            Book Number
        </td>
        <td>
            Title
        </td>
        <td>
            Borrowed By
        </td>
        <td>
            Borrowed Start From
        </td>
        <td>
            State
        </td>
        <td>
            Operation
        </td>
    </tr>
    @{
        foreach (var item in Model)
        {
        <tr>
            <td>@item.Book.BookNumber
            </td>
            <td>@item.Book.BookType.Title
            </td>
            <td>@item.User.DisplayName
            </td>
            <td>@item.BorrowedDate
            </td>
            <td>@(item.IsCheckedOut ? "Checked Out" : "Borrow Accepted")
            </td>
            <td>
                @{
            if (item.IsCheckedOut)
            {
                    @Html.ActionLink("Return", "Return", "Admin", new { borrowId = @item.BorrowRecordId }, null)
            }
            else
            {
                    @Html.ActionLink("Check Out", "CheckOut", "Admin", new { borrowId = @item.BorrowRecordId }, null)
            }
                }
            </td>
        </tr>
      }
    }
</table>

﻿@model IEnumerable<MMLibrarySystem.Models.BorrowRecord>

@{
    ViewBag.Title = "Borrowed Books";
}

<table id="bookList">
    <tr>
        <td>
            Book Number
        </td>
        <td>
            Title
        </td>
        <td>
            Borrowed By
        </td>
        <td>
            Borrowed Start From
        </td>
        <td>
            State
        </td>
        <td>
            Operation
        </td>
    </tr>
    @{
        foreach (var item in Model)
        {
        <tr>
            <td>@item.Book.BookNumber
            </td>
            <td>@item.Book.BookType.Title
            </td>
            <td>@item.User.DisplayName
            </td>
            <td>@item.BorrowedDate
            </td>
            <td>@(item.IsCheckedOut ? "Checked Out" : "Borrow Accepted")
            </td>
            <td>
                @{
            if (item.IsCheckedOut)
            {
                    @Html.ActionLink("Return", "Return", "Admin", new { borrowId = @item.BorrowRecordId }, new { onclick = "return confirm('Are you sure to return this book?')" })
            }
            else
            {
                    @Html.ActionLink("Check Out", "CheckOut", "Admin", new { borrowId = @item.BorrowRecordId }, null)
            }
                }
            </td>
        </tr>
      }
    }
</table>

Add a confirm to revert while wrong operation.
Add a confirm to revert while wrong operation.
