asp net core 2.2入门

最近开始学习asp net core 这个是个跨平台的Web,console,form 基本啥都可以吧,把微软落下的部分,终于追赶了上来。net core 从2016年开始,到现在已经有3年了,最近3.0已经在测试,可能不稳定,官方暂时推荐sdk用2.2。
我这里新手,也不会写博客,字体没有去搞。格式也没有去搞。想到哪里就写到哪里吧。希望能坚持每隔几天,或者每天都在写自己所学习的内容,和大家一起分享吧。
先截图,这个不可以发视频吗?
在这里插入图片描述
这个是我入门刚刚学习的说实话,MVC刚接触有点难,基本花了我快3天的时间我才算知道一点点而已。
我学习的思路是这样子的:
1 主页布局好,每个Demo,独立作为一个功能,单独拿出来,便于以后直接用哦;
2 写一个登录的,这里面没有调用数据库,可以作为入门去理解net core web ;
3 写一个注册的,其实差不多。就搞一个界面出来吧,现在也没有搞数据库;
4 写一个列表的 可以根据读取数据显示
5 访问数据库的
6 websocket客户端可以与server通讯
7 MQTT
8 http
9 UDP
10 开始着手项目了

页面源码我公布下,新手可以看下
Viem/Home/Index.cshtml代码:

@{
ViewData[“Title”] = “主页”;
}

<style>
</style>
<script type="text/javascript">
    function jiafa(a, b) {
        return a + b;
    }

</script>
@* 登录 注册 个人资料 查询 样式:每行一个项目,左边是图标,右边是说明吧 ~/image/denglu.png *@

用户登录

用户注册

@

@

wwwroot/css/Home.css 代码如下:
body {
}

.zhengti {
position:fixed;
margin-top:5%;
margin-left:5%;
margin-bottom:5%;

}
.hang{
position:page;
margin-bottom:10px;
margin-top:10px;
border:solid;
border-width:1px;
margin-left:5%;
width:80%;
height:200px;
vertical-align:middle;
}
.hang:hover {
border: 5px solid red;
}
.hang img {
position: absolute;
height: 180px;
width: 180px;
margin-top:10px;
margin-left:10px;
border: none;
/float:left;/
padding: 1px 1px 1px 1px;
}

.hang p {
    position: absolute;
    text-align:center;
    line-height:200px;
    font-size: 1em;
    height: 200px;
    width: 100%;
    color: black;
}
Controllers/HomeControlle.cs代码如下:
using System;

using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

using mytest.Models;

namespace mytest.Controllers
{
public class HomeController : Controller
{
public static string conf = “Server=localhost;database=mysqlshujuku;uid=root;pwd=175921781;pooling=true;CharSet=utf8;port=3306;sslmode=none”;
public IActionResult Index()
{
//using (MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(conf)) {
// conn.Open();
//}
//return Content(“”);
return View();
}

    public IActionResult Privacy()
    {
        return View();
    }

    [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
    public IActionResult Error()
    {
        return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
    }
}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值