Showing posts with label MVC Tutorials. Show all posts
Showing posts with label MVC Tutorials. Show all posts

Sunday, November 16, 2014

MVC Model Sample with LIST,ADD,EDIT,VIEW,DELETE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using BusinessLogic;
using BusinessObject;
using BusinessObject.Common;
using ERP.Utilities;
using ERPService;

namespace ERPHotel.Models
{
    public class UserLevelModel
    {
        #region Properties

        /// <summary>
        /// Current PK
        /// </summary>
        private int USERLEVELPK
        {
            get;
            set;
        }

        /// <summary>
        /// To maintain the PageIndex in viewstate
        /// </summary>
        private string PageIndex
        {
            get;
            set;
        }
        /// <summary>
        /// To maintain the total pages in viewstate
        /// </summary>
        private int TotalPages
        {
            get;
            set;
        }
        /// <summary>
        /// To maintain the SortExpression or sort By in viewstate
        /// </summary>
        private string SortBy
        {
            get;
            set;
        }

        /// <summary>
        /// To maintain the SortExpression or then By in viewstate
        /// </summary>
        private string ThenBy
        {
            get;
            set;
        }

        /// <summary>
        /// To maintain the Sort Direction in viewstate
        /// </summary>
        private string SortDirection
        {
            get;
            set;
        }
        /// <summary>
        /// To maintain the LastModifiedTime in viewstate
        /// </summary>
        private DateTime LastModifiedTime
        {
            get;
            set;
        }

        /// <summary>
        /// Entry State for managing display status
        /// </summary>
        private EntryStatus EntryStatus
        {
            get;
            set;
        }

        /// <summary>
        /// Page Size
        /// </summary>
        private int PageSize
        {
            get;
            set;
        }


        #endregion     
        [DisplayName("Id")]
        public int ugrp_id { get; set; }
        [DisplayName("Description :")]
        public string ugrp_name { get; set; }
        [DisplayName("Description :")]
        public string ugrp_descr { get; set; }
        [DisplayName("Designation :")]
        public string ugrp_desc { get; set; }
        [DisplayName("Is Admin Group :")]
        public bool ugrp_admin { get; set; }
        [DisplayName("User Management >> User Level")]
        public bool Breadcrumb { get; set; }

        private ServiceUtility serviceUtilityObj;
        private static user_groups user_groupsObj;
        private DataSet dsuser_groups;
        private DataTable dtuser_groups;
     

        #region Get Field Values
        /// <summary>
        /// Gets the data to bind/assign for the controls(inputs, grids, dropdowns etc.)
        /// pass string.empty to get all field values
        /// Assign it to the page level variables
        /// </summary>
        public object GetFieldValues(ControlsEnum type)
        {


            try
            {
                Object retObject;
                retObject = null;
                PageSize = 20;
                switch (type)
                {
                    case ControlsEnum.USERLEVEL:
                        user_groupsObj = new user_groups();
                        user_groupsObj.ugrp_id = USERLEVELPK;
                        serviceUtilityObj = new ServiceUtility();
                        serviceUtilityObj.CurrentPage = PageIndex == null ? 1 : Convert.ToInt32(PageIndex);
                        serviceUtilityObj.PageSize = PageSize;
                        serviceUtilityObj.SortBy = SortBy = SortBy == null ? Resources.DataFieldRes.USERLEVELPK : SortBy;
                        serviceUtilityObj.ThenBy = ThenBy = ThenBy == null ? Resources.DataFieldRes.USERLEVELPK : ThenBy;
                        serviceUtilityObj.SortDirection = SortDirection = SortDirection == null ? Resources.Report.SortDescending : SortDirection;
                        dsuser_groups = user_groupsBL.Getuser_groupsList(user_groupsObj, serviceUtilityObj);

                      
                        retObject = dsuser_groups;

                        serviceUtilityObj.TotalRecords = int.Parse(dsuser_groups.Tables[0].Rows[0][0].ToString());
                        TotalPages = serviceUtilityObj.TotalRecords == 0 ? 1 : (serviceUtilityObj.TotalRecords <= serviceUtilityObj.PageSize) ? 1 :
                                    (serviceUtilityObj.TotalRecords % serviceUtilityObj.PageSize) == 0 ? (serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) :
                                    (serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) + 1;

                        break;
                    case ControlsEnum.USERLEVELDETAILS:
                        dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
                        if (dtuser_groups.Rows.Count > 0)
                        {
                            user_groupsObj = new user_groups();
                            user_groupsObj.ugrp_id = Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
                            user_groupsObj.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
                            user_groupsObj.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
                            user_groupsObj.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);                          
                        }
                        retObject = user_groupsObj;
                        break;
                    case ControlsEnum.USERLEVELSEARCH:
                        user_groupsObj = new user_groups();
                        dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
                        retObject = dtuser_groups;
                        break;


                }
                return retObject;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }
        #endregion

        #region Enum
        /// <summary>
        ///Page Controls Enum
        /// </summary>
        public enum ControlsEnum
        {

            USERLEVEL,
            USERLEVELLIST,
            USERLEVELDETAILS,
            USERLEVELSEARCH
        }
     
        #endregion
    }
}

MVC Controller Sample with LIST,ADD,EDIT,VIEW,DELETE

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using BusinessLogic;
using BusinessObject;
using ERPHotel.Models;

namespace ERPHotel.Controllers
{
    public class UserLevelController : Controller
    {
        private ActionsEnum commonActions;

        //
        // GET: /UserLevel/

        public ActionResult UserLevel(UserLevelModel model)
        {
          
            DataSet ds =(DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);           
            ViewBag.UserLevelList = ds.Tables[1];
            ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing(1);});</script>";
            return View();
        }

        [HttpPost]
        public ActionResult UserLevel(ERPHotel.Models.UserLevelModel model, string Command, FormCollection frmCollection)
        {

            var radio = frmCollection.GetValue("SelectOne");

            int result = 0;
            user_groups objuser_groups = new user_groups();

            commonActions = (ActionsEnum)(Enum.Parse(typeof(ActionsEnum), Command));

            switch (commonActions)
            {
                case ActionsEnum.NEW:
                    break;
                case ActionsEnum.SAVE:
                    if (model != null)
                    {
                        objuser_groups.ugrp_admin = model.ugrp_admin;
                        objuser_groups.ugrp_desc = model.ugrp_desc;
                        objuser_groups.ugrp_id = model.ugrp_id;
                        objuser_groups.ugrp_name = model.ugrp_descr;

                        result = user_groupsBL.Saveuser_groups(objuser_groups, 1);
                        if (result > 0)
                        {
                            DataSet ds = (DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);
                            ViewBag.UserLevelList = ds.Tables[1];
                           
                        }
                    }
                    break;
                case ActionsEnum.DELETE:
                    break;
                case ActionsEnum.CANCEL:
                    break;
                case ActionsEnum.VIEW:
                    break;
                case ActionsEnum.EDIT:
                    if (model != null)
                    {
                       DataTable dtuser_groups = user_groupsBL.Getuser_groups(Convert.ToInt32(radio.AttemptedValue));
                        if (dtuser_groups.Rows.Count > 0)
                        {
                            objuser_groups = new user_groups();
                            objuser_groups.ugrp_id =Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
                            objuser_groups.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
                            objuser_groups.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
                            objuser_groups.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);
                                                       model.ugrp_admin = objuser_groups.ugrp_admin;
                            model.ugrp_desc = objuser_groups.ugrp_desc;
                            model.ugrp_id = objuser_groups.ugrp_id;
                            model.ugrp_descr = objuser_groups.ugrp_name;
                            var ugrp_descr = frmCollection.GetValue("ugrp_descr");
                                               }
                        ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing();});</script>";
                    }
                    break;
            }

            return View(model);
        }

    }
}

MVC Razor Html Design Structure Sample with LIST,ADD,EDIT,VIEW,DELETE

@model ERPHotel.Models.UserLevelModel
@{
    ViewBag.Title = "UserLevel";
    Layout = "~/Views/Home/SiteMaster.cshtml";
}

<html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>User Level</title>
    @section Scripts
{
    @Html.Raw(ViewBag.message)
}

    <script type="text/javascript">

        var pageURL = window.document.URL;
        var virtualPath = "";@* @System.Configuration.ConfigurationManager.AppSettings["VirtualDirectory"].ToString();*@
        var url = pageURL.replace(location.pathname, virtualPath == "" ? "/Handlers/AutoComplete.ashx" : "/" + virtualPath + "Handlers/AutoComplete.ashx");

        $(document).ready(function () {
           
            InitComponents();          
            ShowHideAdvancedSearch();
        });

        function InitComponents() {
            ERPScriptUtils.MakeAutoCompleteDDL("txtuserlevel", url, "hdfuserlevel", true, true, "USERLEVELAUTO");
        }

        function ShowHideAdvancedSearch(flag) {
            //If flag then Show AdvancedSearch
            if (flag) {
                $("[id$=tbladvancedSearch]").show();
                $("[id$=imbShowFilter]").hide();
                $("[id$=imbHideFilter]").show();
            }
            else {
                $("[id$=tbladvancedSearch]").hide();
                $("[id$=imbShowFilter]").show();
                $("[id$=imbHideFilter]").hide();
            }
            return false;
        }

        function ShowListing(flag) {
            alert(flag);
            if (flag) {

                $("[id$=PageAction_List]").show();
                $("[id$=PageAction_Entry]").hide();
                $("[id$=pnlListing]").show();
                $("[id$=pnlEntry]").hide();
                $("[id$=ModifiedDatePnl]").hide();
            }
            else {

                $("[id$=PageAction_List]").hide();
                $("[id$=PageAction_Entry]").show();
                $("[id$=pnlListing]").hide();
                $("[id$=pnlEntry]").show();
            }
            return false;
        }
        function ValidateNow() {
            if (typeof (Page_ClientValidate) == 'function') {
                Page_ClientValidate();
            }
            if (!Page_IsValid) {
                $("[id$=litErrorMsg]").hide();
                ShowErrorMessage($("#diverror").html());
                return false;  //Page is invalid -- stop right here
            }
            else {
                //everythings ok --- Call your function & do your stuff
                return true;
            }
        }

        function ViewMode(mode) {
            //Mode = 1 Indicates its on View Mode
            //Mode = 2 Indicates its on New Mode
            if (mode == 1) {
                $("[id$=pnlSave]").hide();
                $("[id$=pnlDelete]").hide();
            }
            else if (mode == 2) {
                $("[id$=pnlDelete]").hide();
            }
        }
        function radioselect(_this) {         
            $("[id$=hdfid]").val("1");
            //$("[id$=btnEdit]").click();
            //ShowListing();
        }


    </script>
</head>

<body>
    @using (Html.BeginForm("UserLevel", "UserLevel", FormMethod.Post))
    {
        <div class="fixed-buttons">
            <div class="button_container">
                <table>
                    <tr>
                        @*SEC_ACTION is a dummy cssclass  FOR Accessing the Buttons in the Table Cell*@
                        <td id="SEC_ActionPanel" class="SEC_ACTION">
                            <ul class="bredcrum">
                                @Html.LabelFor(m => m.Breadcrumb)

                            </ul>
                            <ul id="pnlEntry" style="display: none">
                                <li runat="server" id="pnlSave">
                                    <input type="submit" name="Command" title="@Resources.Controls.Save" 
                                        value="@Resources.Controls.Save"  class="bttn_save" id ="btnSave" />
                                </li>
                                <li runat="server" id="pnlDelete">
                                    <input type="submit" name="Command" title="@Resources.Controls.Delete" 
                                        value="@Resources.Controls.Delete" onclick="ValidateNow()" class="bttn_delete" id ="btnDelete" />
                                </li>
                                <li>
                                    <input type="submit" name="Command" title="@Resources.Controls.Cancel" 
                                        value="@Resources.Controls.Cancel" onclick="ValidateNow()" class="bttn_cancel" id ="btnCancel" />
                                </li>
                            </ul>
                            <ul id="pnlListing" style="display: none">
                                <li>
                                    <input type="button" name="Command" title="@Resources.Controls.New" 
                                        value="@Resources.Controls.New" onclick="ShowListing()" class="bttn_new" id ="btnNew" />
                                </li>
                                <li>
                                    <input type="submit"  name="Command"  title="@Resources.Controls.Edit" 
                                        value="@Resources.Controls.Edit"  class="bttn_edit" id ="btnEdit" />
                                </li>
                                <li>
                                    <input type="submit" name="Command" title="@Resources.Controls.View" 
                                        value="@Resources.Controls.View" onclick="ValidateNow()" class="bttn_view" id ="btnView" />
                                </li>

                            </ul>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="horizontalTab">
            <ul class="resp-tabs-list">
                <li runat="server" id="lilist" class="resp-tab-active">
                    <a id="lnkList" tabindex="33" class="tab-active" href="javascript:__doPostBack(lnkList)"
                        style="font-family: Verdana; text-decoration: none;">@Resources.PageNameRes.List</a>
                </li>
                <li runat="server" id="lidetail">
                    <a id="lnkDetail" tabindex="33" class="tab-inactive" href="javascript:__doPostBack(lnkDetail)"
                        style="font-family: Verdana; text-decoration: none;">@Resources.PageNameRes.Detail</a>
                </li>
            </ul>

            <table id="tblTemplate" class="asptbllinks">
                <tr>
                    <td>
                        <table id="PageAction_List">
                            <tr>
                                <td>
                                    <div class="search-colapse">
                                        <table>
                                            <tr>
                                                <td>
                                                    <h1>@Resources.Controls.AdvanceSearch</h1>
                                                </td>
                                                <td>
                                                    <input type="image" name="imbShowFilter" id="imbShowFilter" tabindex="65"
                                                        title="Show Filter" src="~/Content/images/Classic/Icons/arrow-colapse-inactive.png"
                                                        onclick="javascript: return ShowHideAdvancedSearch(1);"
                                                        style="border-width: 0px;" />
                                                    <input type="image" name="imbHideFilter" id="imbHideFilter" tabindex="66"
                                                        title="Hide Filter" src="~/Content/images/Classic/Icons/arrow-colapse-active.png"
                                                        onclick="javascript: return ShowHideAdvancedSearch();"
                                                        style="border-width: 0px;" />
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    @*colpase btn*@
                                    <div class="clear">
                                    </div>
                                    <table class="table-devide advance-search" id="tbladvancedSearch" style="margin-top: 8px;">
                                        <tr id="Tr1">
                                            <td>
                                                <div class="div2col-S">
                                                    @Html.LabelFor(m => m.ugrp_name)
                                                    @Html.TextBoxFor(m => m.ugrp_name, new { id = "txtuserlevel" })
                                                    @Html.HiddenFor(m => m.ugrp_id, new { id = "hdfuserlevel" })
                                                    <div class="clear">
                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="div2col-S">
                                                    <input type="submit" name="SEARCH" title="@Resources.Controls.Search" 
                                        value="@Resources.Controls.Search"  class="bttn_search" id ="btnSearch" />
                                                    <input type="submit" name="CLEAR" title="@Resources.Controls.Clear" 
                                        value="@Resources.Controls.Clear"  class="bttn_cancel" id ="btnClear" />

                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                    <div class="clear">
                                    </div>
                                    <div class="gridwrap">
                                        <table class="gridwrap" cellspacing="0" cellpadding="0" border="1" style="border-color: #D0D7E9; border-width: 1px; border-style: Solid; height: 10px; width: 100%; border-collapse: collapse;"
                                            id="grdUserLevel" rules="rows">
                                            <tbody>
                                                <tr class="grdhead" align="left" style="color: #506C92; border-width: 0px; font-family: Verdana; font-size: 10px; height: 25px;">
                                                    <th scope="col">&nbsp;
                                                    </th>
                                                    <th scope="col">
                                                        <a href="javascript:__doPostBack()" style="color: #506C92;">User Level</a>
                                                    </th>
                                                    <th scope="col">
                                                        <a href="javascript:__doPostBack()" style="color: #506C92;">Description</a>
                                                    </th>
                                                </tr>
                                                @if (ViewBag.UserLevelList!=null)
                                                {
                                                    foreach (System.Data.DataRow dr in ViewBag.UserLevelList.Rows)
                                                    {
                                                        <tr style="color: #263D62; background-color: White; border-color: #D0D7E9; border-width: 1px; border-style: Solid; font-family: Verdana; font-size: 11px; height: 10px;">
                                                            <td>
                                                                <input type="radio" name="SelectOne"                                                               
                                                                    id="@dr[@Resources.DataFieldRes.USERLEVELPK].ToString()"
                                                                    value="@dr[@Resources.DataFieldRes.USERLEVELPK].ToString()"
                                                                    onclick ="radioselect(@dr[Resources.DataFieldRes.USERLEVELPK].ToString())"
                                                                    />
                                                            </td>
                                                            <td>
                                                                @dr[@Resources.DataFieldRes.USERLEVEL].ToString()
                                                            </td>
                                                            <td>
                                                                @dr[@Resources.DataFieldRes.USERLEVELDESC].ToString()
                                                            </td>
                                                        </tr>
                                                    }
                                                }
                                            </tbody>
                                        </table>

                                    </div>
                                </td>
                            </tr>
                        </table>
                        <table id="PageAction_Entry">
                            <tr>
                                <td>
                                    <table class="table-devide">
                                        <tr>
                                            <td>
                                                <div class="div2col-S">
                                                    @Html.LabelFor(m => m.ugrp_descr)
                                                    @Html.TextBoxFor(m => m.ugrp_descr)
                                                    @Html.ValidationMessageFor(m => m.ugrp_descr)

                                                    <div class=" clear">
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <div class="div2col-S">
                                                    @Html.LabelFor(m => m.ugrp_desc)
                                                    @Html.TextBoxFor(m => m.ugrp_desc)
                                                    @Html.ValidationMessageFor(m => m.ugrp_desc)

                                                    <div class=" clear">
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <div class="div2col-S">
                                                    @Html.LabelFor(m => m.ugrp_admin)
                                                    @Html.CheckBoxFor(m => m.ugrp_admin)
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            @Html.HiddenFor(m => m.ugrp_id, new { id = "hdfid",value="0" })
            <div id="diverror" style="display: none">
                @*Use this label to bind the server errors*@

            </div>
        </div>
    }

</body>
</html>

Master Content Page in MVC

Home.cshtml

@{
    ViewBag.Title = "Home";
    Layout = "~/Views/Home/SiteMaster.cshtml";
}


Master Page creation in MVC

SiteMaster.cshtml (Razor HTML)

<!DOCTYPE html>

<html>
<head>

    <title>Hotel Management</title>
    <link rel="shortcut icon" type="image/x-icon" href="~/Content/images/favicon.ico" />
    <link href="~/App_Themes/ERP-Blue/Classic.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/style.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/white.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/Component.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/lightbox.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/pickmeup.css" rel="stylesheet" type="text/css" />
    <link href="~/App_Themes/ERP-Blue/easy-responsive-tabs.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
    <style type="text/css">
        .fixed_overlay
        {
            position: fixed !important;
            left: 0 !important;
            top: 0 !important;
        }

        .fixed_overlay_img
        {
            left: 50% !important;
            top: 50% !important;
        }

        .fixed_overlay_img_pos
        {
            position: fixed !important;
        }

        .demo
        {
            width: 980px;
            margin: 0px auto;
        }

            .demo h1
            {
                margin: 33px 0 25px;
            }

            .demo h3
            {
                margin: 10px 0;
            }

        pre
        {
            background: #fff;
        }

        #tabInfo
        {
            display: none;
        }
    </style>
    <script src="@Url.Content("~/Scripts/jquery/jquery-1.5.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Jquery/jquery-ui.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery/UI/jquery.ui.datetimepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery/UI/timepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ERPGridMulti.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery/json2.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Menu/fgmenu.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ERPScriptUtils.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ERPTreeMulti.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageScript/MasterPage.js")" type="text/javascript"></script>
    @RenderSection("Scripts", false)
</head>
<body>
    <center>
            <div class="wrapper">
                <div class="header">
                    <span class="logo">
                        <img src="~/Content/images/ERP-Blue/logo.png" />
                    </span>
                    <div class="head_slogn" id="divHead" runat="server">
                    </div>
                    <div class="user_area">
                        <span class="wel">Welcome Admin</span> <a href="../../AccountManagement/Inbox.aspx">
                            <span class="hme">Home</span></a> <a href="../../Login.aspx"><span class="logout">Logout</span></a>
                    </div>
                </div>
                <div class="main_container">
                    <div class="left_section">
                        <div class="menu">
                           @{Html.RenderAction("MenuPartialView", "Menu");}
                        </div>
                        @RenderBody()
                    </div>
                    <span class="right_cntrols"><a href="#" title="Profile" style="display: none"><span
                        class="profile" title="PROFILE"></span></a><a href="#"><span class="email" title="EMAIL">
                        </span></a><a href="#"><span class="sms" title="SMS"></span></a><a runat="server"
                            id="helplink"><span class="help" title="HELP"></span></a></span>
                    <div class="right_panel">
                        <span class="right_head">Calendar</span>
                        <section>
                        <article>
                            <div >
                         
                            </div>
                        </article>
                    </section>
                        <span class="right_head" id="NewsHd" runat="server" style="display: none">News</span>
                        <div class="news-p">
                        </div>
                        <a href="../NewsManagement/NewsMaster.aspx" class="more_events" style="display: none">
                            View More +</a>
                    </div>
                </div>
            </div>
            <div class="footer">
                <span class="cpyright">Copyright © 2014, eCreations</span>
            </div>
        </center>




</body>
</html>

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...