Giter Club home page Giter Club logo

iblog's Introduction

ITungBlog

This project was generated with Angular CLI version 13.3.0. -Trang web sử dụng ASP.NET Core Web API CRUD cùng angular -Trong đó: 1. Về phía back-end ta tạo các phương thức bất đồng bộ async: +GetAllPosts: trả về list post lấy từ dbcontext. +GetPostById: kiểm tra id của post trong db có trùng với id cần tìm => trả về post đó nếu trùng. +AddPost:nhập dữ liệu cho AddPostRequest rồi chuyển đổi DTO AddPostRequest sang entity post với post.Id = Guid.New.Guild(); => add post mới vào dbcontext => savechanges => trả về post mới +UpdatePost:tìm post có id cần cập nhật gán vào 1 object mới => thông tin cập nhật từ DTO UpdatePostRequest sẽ được gán lại cho object mới đó => lưu thay đổi và trả về post sau khi được update. +DeletePost: Tìm id từ dbcontext nếu có sử dụng remove để xoá => lưu thay đổi. 2. Từ cotroller ta gửi api tới front-end khi có yêu cầu => cần tạo chính sách cho back-end và front-end giao tiếp: services.AddCors(options => options.AddPolicy("default", policy => { policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin();

        }));
 3.Front-end: tạo các phương thức tương tự để gửi yêu cầu xuống server với httpservice

iblog's People

Contributors

nhuy-tung avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.