Introduction

We saw how to use CSS rules to control the style and layout of a page.

Bootstrap is a collection of prewritten CSS rules used to build web pages faster. Bootstrap provides styles out of the box for several common components on a web page, such as grid layouts, navigation, showcases, and much more.

Let's see how to get started using Bootstrap in your web page.




The grid

grid is a useful way to create page layouts. Rather than create layouts from scratch, HTML elements can be aligned to a grid in different ways to create custom layouts.

Bootstrap comes with a grid that is made up of 12 equal-sized columns. HTML elements are arranged to span different numbers of columns in order to create custom page layouts.



Bootstrap's grid is made up of 12 equal-sized columns. Each piece of content is aligned to this grid by specifying the number of columns to span.

The code to the right uses Bootstrap's grid to create a layout with two pieces of content.

Here each piece of content spans six columns, so it uses the .col-md-6 class.

Both columns are wrapped in a .row class to create a horizontal group.


<ul class="nav nav-tabs">

<li><a href="#">Primary</a></li>

<li class="active"><a href="#">Social</a></li>

<li><a href="#">Promotions</a></li>

<li><a href="#">Updates</a></li>

</ul>


<ul class="nav nav-pills">

<li><a href="#">Primary</a></li>

<li class="active"><a href="#">Social</a></li>

<li><a href="#">Promotions</a></li>

<li><a href="#">Updates</a></li>

</ul>



Summary

By adding Bootstrap classes to your HTML elements, you can make use of Bootstrap's CSS to build your page faster. This lets you quickly set up the basic styles and layout so that you can get to the more interesting aspects of your page's design.

Bootstrap provides CSS for many more web components. Check out this site to see how else you can use Bootstrap to style your HTML elements!


반응형

'Frontend' 카테고리의 다른 글

make an Interactive Website 3 JavaScript  (0) 2014.08.22
make an Interactive Website 2 Jquery coding  (0) 2014.08.22
make an Interactive Website 1  (0) 2014.08.21
make website 3 coding  (0) 2014.08.21
make web site 1 by codecademy  (0) 2014.08.21




Introduction

A web page is a collection of HTML elements. CSS can control the design of an element, like its color, font, and spacing.

CSS can also control where an element sits on a page to create a page layout.

For example, the layout to the right has a top navigation bar, a large feature element, a grid of images, and then three pieces of supporting content.

What CSS properties are available to move elements around and create page layouts? Here are three common CSS properties.



display

CSS treats HTML elements like boxes. A box can be "block" or "inline".

  • Block elements display on a new line (e.g.,h1pulli).

  • Inline elements display on the same line as their neighboring elements (e.g., imga)

It's possible to change whether a box is block or inline by using the display property.







position

The position property is used to move an HTML element to a precise position on the page.

By setting position: relative, you can use the CSS properties topleftbottom, andright to shift an element away from where it would have normally appeared on the page.



float

The float property moves an element to the far left or far right of the page.

For example, setting float: right pulls an element to the far right side of the page, and the surrounding text wraps around it.



반응형

'Frontend' 카테고리의 다른 글

make an Interactive Website 3 JavaScript  (0) 2014.08.22
make an Interactive Website 2 Jquery coding  (0) 2014.08.22
make an Interactive Website 1  (0) 2014.08.21
make website 3 coding  (0) 2014.08.21
make web site 2 bootstrap  (0) 2014.08.21

margin

The properties margin-left, andmargin-right are available to set themargin on either side of an HTML element. If one of these properties is set to auto, then it will take as much as possible.

To move the HTML element to the far left of the screen, use margin-right: auto. This will maximize the amount of space there is on the right side margin, pushing the element to the far left.

To center an element, setmargin-right: auto and margin-left: auto. The margin to the left and right will be equal and the element will be centered.


스크린의 왼쪽으로 떨어트리고 싶을때는 ,  margin-right: auto

오른쪽의 margin 공백을 최대치로 두기때문에, 왼쪽으로 이동하게 된다. 


요소를 중앙으로 데려오고 싶을 경우, margin-right: auto and margin-left: auto

 하게되면, 그 요소들이 각각 동일하게 여백이 적용될 것이라, 중간에 올 것이다. 



반응형

'Frontend > HTML5' 카테고리의 다른 글

.prependTo()  (0) 2014.08.22
make an Interactive Website 5 coding  (0) 2014.08.22
ASP.NET MVC4 WEB API  (1) 2013.10.22
Javascript / text / cs 연결할 때  (59) 2013.08.30
jQuery의 정의 셀렉터를 사용한 radio 버튼 값 가져오기  (60) 2013.08.29


블로그에 소스를 삽입 하자!




1.  The latest SyntaxHighlighter version is 3.0.83download.

shttp://alexgorbatchev.com/SyntaxHighlighter/download/


2. syntaxhighlighter_3.0.83\scripts 의 파일들을 모두 업로드한다.  shCore.js and shCore.css) 

3. D:\downloads\syntaxhighlighter_3.0.83\syntaxhighlighter_3.0.83\styles 의 파일 중, 

shCore.css 그외 테마들 중에 선태해서 업로드한다 ( 나는, shCoreRDark.css )


4. skin.html에 css와 js를 include한다. 


* css (shCore.css 와 사용할 테마.css)


<link rel="stylesheet" type="text/css" href="./images/shCoreMidnight.css">


* js


필요한 js를 모두 import 한다.

<script type="text/javascript">
    SyntaxHighlighter.all();

</script>




http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html


5. 설치는 끝.


* 사용 방법

<pre /> method
 
function test()
{
alert('test');
}

<script /> method
<script type="syntaxhighlighter" class="brush: js">
<![CDATA[
  /**
   * SyntaxHighlighter
   */
  function foo()
  {
      if (counter <= 10)
          return;
      // it works!
  }
]]>
</script>



* brush


Brush name

Brush aliases

File name

ActionScript3as3, actionscript3shBrushAS3.js
Bash/shellbash, shellshBrushBash.js
ColdFusioncf, coldfusionshBrushColdFusion.js
C#c-sharp, csharpshBrushCSharp.js
C++cpp, cshBrushCpp.js
CSScssshBrushCss.js
Delphidelphi, pas, pascalshBrushDelphi.js
Diffdiff, patchshBrushDiff.js
Erlangerl, erlangshBrushErlang.js
GroovygroovyshBrushGroovy.js
JavaScriptjs, jscript, javascriptshBrushJScript.js
JavajavashBrushJava.js
JavaFXjfx, javafxshBrushJavaFX.js
Perlperl, plshBrushPerl.js
PHPphpshBrushPhp.js
Plain Textplain, textshBrushPlain.js
PowerShellps, powershellshBrushPowerShell.js
Pythonpy, pythonshBrushPython.js
Rubyrails, ror, rubyshBrushRuby.js
ScalascalashBrushScala.js
SQLsqlshBrushSql.js
Visual Basicvb, vbnetshBrushVb.js
XMLxml, xhtml, xslt, html, xhtmlshBrushXml.js



기타 사용 방법 참조

http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html



반응형



High quality PSD file + link to download the icons pack.
https://dribbble.com/shots/1669894-Free-Resume-template-vol-3




https://www.dropbox.com/s/yjuwik7ttvr6x2v/CV_Design_JohnDoe.psd


반응형

'INSIGHT' 카테고리의 다른 글

머신러닝 공부 순서  (0) 2019.03.11
우리는 Github를 이렇게 사용한다.  (0) 2019.03.08
구글, “5년간 AI 개발자 5만명 교육하겠다”  (0) 2019.03.08
Web Design Trends To Look Out For In 2015  (0) 2014.11.03
Templates  (0) 2014.08.14



flat 템플릿, bootstrap 


http://startbootstrap.com/template-categories/all/

반응형



 

- AMQP(Advanced Message Queue Protocol) + elang으로 구성.

  1. 클라이언트들에서 메시지를 받아서 분배하는 역할

 

* 나의 경우는 웹으로 모니터링 할 수 있게끔 c#으로 client를 구축

1. 홈페이지에서 rabbitmq-dotnet-client-3.3.4-dotnet-3.0.zip 을 받아, RabbitMQ.Client.dll 을 참조하여 RabbitMQ 사용할 준비를 끝낸다.

2. 이 토끼씨는... 예제가 잘 되어 있다. 언어별로... ㅎ 여기를 차근차근 따라하면 okay! (Tutorials : http://www.rabbitmq.com/getstarted.html)

또한, pdf도 제공하고 있으니,, 자세한것은 pdf 참고!! ( 나의 경우는 //2.8. Retrieving messages by subscription used. )

 

3. 기본 알고리즘

var factory = new ConnectionFactory()

{

UserName = "username",

Password = "password",

Protocol = Protocols.FromEnvironment(),

Port = AmqpTcpEndpoint.UseDefaultPort,

//factory.Uri = "amqp://user:pass@hostName:port/vhost";

Uri = "amqp://username:password@uri"

};

 

public class ConnectionFactory

{

public const ushort DefaultChannelMax = 0;

public const int DefaultConnectionTimeout = 30000;

public const uint DefaultFrameMax = 0;

public const ushort DefaultHeartbeat = 0;

public const string DefaultPass = "guest";

public const string DefaultUser = "guest";

public const string DefaultVHost = "/";

 

public AuthMechanismFactory[] AuthMechanisms;

public IDictionary<string, object> ClientProperties;

public static AuthMechanismFactory[] DefaultAuthMechanisms;

public string HostName;

public string Password;

public int Port;

public IProtocol Protocol;

public ushort RequestedChannelMax;

public int RequestedConnectionTimeout;

public uint RequestedFrameMax;

public ushort RequestedHeartbeat;

public ConnectionFactory.ObtainSocket SocketFactory;

public SslOption Ssl;

public string UserName;

public string VirtualHost;

 

public ConnectionFactory();

 

public AmqpTcpEndpoint Endpoint { get; set; }

public string Uri { set; }

public Uri uri { set; }

 

public AuthMechanismFactory AuthMechanismFactory(string[] mechs);

public virtual IConnection CreateConnection();

public virtual IConnection CreateConnection(int maxRedirects);

protected virtual IConnection CreateConnection(int maxRedirects, IDictionary<AmqpTcpEndpoint, int> connectionAttempts, IDictionary<AmqpTcpEndpoint, Exception> connectionErrors, params AmqpTcpEndpoint[] endpoints);

public static TcpClient DefaultSocketFactory(AddressFamily addressFamily);

protected virtual IConnection FollowRedirectChain(int maxRedirects, IDictionary<AmqpTcpEndpoint, int> connectionAttempts, IDictionary<AmqpTcpEndpoint, Exception> connectionErrors, ref AmqpTcpEndpoint[] mostRecentKnownHosts, AmqpTcpEndpoint endpoint);

 

public delegate TcpClient ObtainSocket(AddressFamily addressFamily);

}

 

 

 

IConnection conn = factory.CreateConnection();

 

public interface IConnection : IDisposable

{

bool AutoClose { get; set; }

ushort ChannelMax { get; }

IDictionary<string, object> ClientProperties { get; }

ShutdownEventArgs CloseReason { get; }

AmqpTcpEndpoint Endpoint { get; }

uint FrameMax { get; }

ushort Heartbeat { get; }

bool IsOpen { get; }

AmqpTcpEndpoint[] KnownHosts { get; }

IProtocol Protocol { get; }

IDictionary<string, object> ServerProperties { get; }

IList<ShutdownReportEntry> ShutdownReport { get; }

 

event CallbackExceptionEventHandler CallbackException;

event ConnectionBlockedEventHandler ConnectionBlocked;

event ConnectionShutdownEventHandler ConnectionShutdown;

event ConnectionUnblockedEventHandler ConnectionUnblocked;

 

void Abort();

void Abort(int timeout);

void Abort(ushort reasonCode, string reasonText);

void Abort(ushort reasonCode, string reasonText, int timeout);

void Close();

void Close(int timeout);

void Close(ushort reasonCode, string reasonText);

void Close(ushort reasonCode, string reasonText, int timeout);

IModel CreateModel();

void HandleConnectionBlocked(string reason);

void HandleConnectionUnblocked();

}

 

 

IModel channel = conn.CreateModel();

channel.QueueDeclare(inputQueueName, durable, autoDelete, autoDelete, arguments);

 

 

public interface IModel : IDisposable

{

ShutdownEventArgs CloseReason { get; }

IBasicConsumer DefaultConsumer { get; set; }

bool IsClosed { get; }

bool IsOpen { get; }

ulong NextPublishSeqNo { get; }

 

event BasicAckEventHandler BasicAcks;

event BasicNackEventHandler BasicNacks;

event BasicRecoverOkEventHandler BasicRecoverOk;

event BasicReturnEventHandler BasicReturn;

event CallbackExceptionEventHandler CallbackException;

event FlowControlEventHandler FlowControl;

event ModelShutdownEventHandler ModelShutdown;

 

[AmqpMethodDoNotImplement("")]

void Abort();

[AmqpMethodDoNotImplement("")]

void Abort(ushort replyCode, string replyText);

void BasicAck(ulong deliveryTag, bool multiple);

[AmqpMethodDoNotImplement("")]

void BasicCancel(string consumerTag);

[AmqpMethodDoNotImplement("")]

string BasicConsume(string queue, bool noAck, IBasicConsumer consumer);

[AmqpMethodDoNotImplement("")]

string BasicConsume(string queue, bool noAck, string consumerTag, IBasicConsumer consumer);

[AmqpMethodDoNotImplement("")]

string BasicConsume(string queue, bool noAck, string consumerTag, IDictionary<string, object> arguments, IBasicConsumer consumer);

[AmqpMethodDoNotImplement("")]

string BasicConsume(string queue, bool noAck, string consumerTag, bool noLocal, bool exclusive, IDictionary<string, object> arguments, IBasicConsumer consumer);

[AmqpMethodDoNotImplement("")]

BasicGetResult BasicGet(string queue, bool noAck);

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

void BasicNack(ulong deliveryTag, bool multiple, bool requeue);

[AmqpMethodDoNotImplement("")]

void BasicPublish(PublicationAddress addr, IBasicProperties basicProperties, byte[] body);

[AmqpMethodDoNotImplement("")]

void BasicPublish(string exchange, string routingKey, IBasicProperties basicProperties, byte[] body);

[AmqpMethodDoNotImplement("")]

void BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, byte[] body);

[AmqpMethodDoNotImplement("")]

void BasicPublish(string exchange, string routingKey, bool mandatory, bool immediate, IBasicProperties basicProperties, byte[] body);

void BasicQos(uint prefetchSize, ushort prefetchCount, bool global);

[AmqpMethodDoNotImplement("")]

void BasicRecover(bool requeue);

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

void BasicRecoverAsync(bool requeue);

void BasicReject(ulong deliveryTag, bool requeue);

[AmqpMethodDoNotImplement("")]

void Close();

[AmqpMethodDoNotImplement("")]

void Close(ushort replyCode, string replyText);

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

[AmqpMethodDoNotImplement("")]

void ConfirmSelect();

[AmqpContentHeaderFactory("basic")]

IBasicProperties CreateBasicProperties();

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]

[AmqpContentHeaderFactory("file")]

IFileProperties CreateFileProperties();

[AmqpContentHeaderFactory("stream")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]

IStreamProperties CreateStreamProperties();

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]

void DtxSelect();

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]

void DtxStart(string dtxIdentifier);

[AmqpMethodDoNotImplement("")]

void ExchangeBind(string destination, string source, string routingKey);

[AmqpMethodDoNotImplement("")]

void ExchangeBind(string destination, string source, string routingKey, IDictionary<string, object> arguments);

[AmqpMethodDoNotImplement("")]

void ExchangeDeclare(string exchange, string type);

[AmqpMethodDoNotImplement("")]

void ExchangeDeclare(string exchange, string type, bool durable);

[AmqpMethodDoNotImplement("")]

void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, IDictionary<string, object> arguments);

[AmqpMethodDoNotImplement("")]

void ExchangeDeclarePassive(string exchange);

[AmqpMethodDoNotImplement("")]

void ExchangeDelete(string exchange);

[AmqpMethodDoNotImplement("")]

void ExchangeDelete(string exchange, bool ifUnused);

[AmqpMethodDoNotImplement("")]

void ExchangeUnbind(string destination, string source, string routingKey);

[AmqpMethodDoNotImplement("")]

void ExchangeUnbind(string destination, string source, string routingKey, IDictionary<string, object> arguments);

[AmqpMethodDoNotImplement("")]

void QueueBind(string queue, string exchange, string routingKey);

[AmqpMethodDoNotImplement("")]

void QueueBind(string queue, string exchange, string routingKey, IDictionary<string, object> arguments);

[AmqpMethodDoNotImplement("")]

QueueDeclareOk QueueDeclare();

[AmqpMethodDoNotImplement("")]

QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive, bool autoDelete, IDictionary<string, object> arguments);

[AmqpMethodDoNotImplement("")]

QueueDeclareOk QueueDeclarePassive(string queue);

[AmqpMethodDoNotImplement("")]

uint QueueDelete(string queue);

[AmqpMethodDoNotImplement("")]

uint QueueDelete(string queue, bool ifUnused, bool ifEmpty);

[AmqpMethodDoNotImplement("")]

uint QueuePurge(string queue);

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

void QueueUnbind(string queue, string exchange, string routingKey, IDictionary<string, object> arguments);

void TxCommit();

void TxRollback();

void TxSelect();

[AmqpMethodDoNotImplement("")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

bool WaitForConfirms();

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

[AmqpMethodDoNotImplement("")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

bool WaitForConfirms(TimeSpan timeout, out bool timedOut);

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

[AmqpMethodDoNotImplement("")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

void WaitForConfirmsOrDie();

[AmqpMethodDoNotImplement("")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]

void WaitForConfirmsOrDie(TimeSpan timeout);

}

 

 

 

반응형


저장 프로시저 사용 시, 


Error converting data type varchar to int.


이런 에러가 난다면, 


 EXEC PR_LIST_P '7', NULL, 2


요런 파람 순서를 잘 보자. 섞여있을 수 있으니,, 


반응형

 

WEB API

SOAP, WS 보다 기본적인 HTTP 위에 노출된 서비스와 같은RESTful 서비스 개발 가능

 

  1. 프로젝트 만들기
    1. ASP.NET MVC 4 PROJECT > project name : 'WorkManagerSimple '
    2. PROJECT TEMPLATE > Web API

      *NuGet 사용 : 패키지관리솔루션

       

  2. Controller > ValuesController.cs
  3. Models > Add > Class > WorkManager.cs 생성
    1. Entity Framework의 code First 컨벤션을 사용
      1. public class WorkManager
      2. {
      3. public int id { get; set; }
      4. public string name { get; set; }
      5. public string detail { get; set; }
      6. }
  4. Controller에서 폴더 추가하여 Web API컨트롤러 분리시킨다.
    1. Controller > new folder > Apis
    2. Apis > add > Controller
      1. Controller name : workmgtController
      2. Tamplate : MVC controller with read/write actions and views, using Entity Framework
      3. Model class :
      4. ..... http://www.youtube.com/watch?v=Dkgr3lpE_LY
반응형

ORDER BY CASE 필드이름 WHEN '' THEN 1 <- '1' 우선순위

WHEN '조건' THEN 2

WHEN '조건' THEN 3 END , INPUT_DATE DESC

 

 

)

ORDER BY CASE DBO.FN_GET_ STANDARD_YN(A._SEQ)

WHEN 'N' THEN 1 WHEN 'Y' THEN 2 END, INPUT_DT DESC

 

=> 1순위로 GET_STANDARD_YN N 일때 정렬함.

반응형

MYSQL에서는 KEY값에다가 AUTOINCREMENT 라고 써주며 되었던 것 같은데, MSSQL에서는 조금 다른 것 같다.

 

| 방법1. CREATE TABLE

테이블 생성 할 때, 컬럼명 옆에 아래와 같이  IDENTITY 라고 작성해 준다. 

   [MEDIA_SEQ] [int] IDENTITY(1,1) NOT NULL,
    [CATEGORY] [nvarchar](50) NOT NULL,
    [FIMENAME] [nvarchar](50) NOT NULL,

 

| 방법2. Microsoft SQL Server Management studio 

반응형

'Database > MSsql' 카테고리의 다른 글

[MSSQL] DATEDIFF ( datepart , startdate , enddate )  (0) 2014.08.29
MS-SQL DATETIME CONVERT  (59) 2013.08.29
MSSQL AUTO INCREMENT INIT  (57) 2013.07.04
[MSSQL] Database 복원  (0) 2013.05.07

 

 

public ActionResult Create()

{

return View();

}

 

public ActionResult Details(int id = 0)

{

Works works = db.Works.Find(id);

if (works == null)

{

return HttpNotFound();

}

return View(works);

}

 

 

유효성 검사

 

이 모든 것이 자동으로 생성된다! 완전 편리해~~~~~ sPRING할 때 유효성검사 다 지정해 줬어야 했는데 여기는 완전 할 필요도 없그만!

 

코드의 Model 개체는 강력한 형식이므로 (IEnumerable<Movie> 개체), 루프문 내부의 item 개체는 Movie 형식입니다. 결과적으로, 다른 여러 가지 장점들과 함께, 컴파일 시점 검사와 코드 편집기 상에서의 완벽한 인텔리센스를 지원 받을 있습니다

반응형

 

  1. 컨트롤러에서 모델 데이터에 접근하기

스캐폴딩(Scaffolding) 기능을 이용하여 새로운 컨트롤러와 뷰를 추가한다.

(CRUD(Create, Read, Update, Delete) 관련된 액션 메서드와 뷰들을 생성해주는 것입니다. (이런 방식으로 자동으로 만들어진 CRUD 액션 메서드와 뷰들을 다른 말로 스캐폴딩(Scaffolding)이라고도 부릅니다)

 

- 컨트롤러 추가

: Controller 폴더 > 우클릭 > Add > Controller

 

DB가 잘 연결될 수 있도록 해당사항에 잘 연결한다.

    

 

 

db에서 key인 것에 키를 등록한다.

 

using System.ComponentModel.DataAnnotations;

 

[Key]

public int SEQ { get; set; }

 

 

그러면 오류생기지 않고 컨트롤러 만들 수 있다!

 

* 전체적 흐름

 

 

기본화면

 

 

 

 

반응형

 

* 컨트롤러에서 뷰로 정보를 전달하는 방법

컨트롤러 클래스 : URL 요청에 대한 응답과정을 호출 -> 전달된 브라우저 요청을 처리 -> DB에서 데이터를 가져온다 -> 어떤 형식의 응답을 브라우저에 전송할 것인지를 결정하는 코드들이 작성되는 위치! -> 후에, 브라우저로 전달될 HTML 응답을 생성하고 형식화하기 위해 컨트롤러에 템프릿을 사용

뷰템플릿은 업무 로직을 수해아거나, 직접 연결해서는 안된다! 모든 데이터는 컨트롤러에서부터 받아서 작업을 수행! => 이로써 유지보수가 용이한 코드를 유지할 있다.

 

  1. 모델추가하기
  2. Modes 폴더 > 우클릭 Add > New Item > Code > Class 선택 > Work.cs
    1. 만들어진 해당 클래스에 데이터베이스에서 정보를 가지고 올 수 있도록 선언한다.
      1. public class Work
      2. {
      3. // 데이터베이스의 정보를 나타내기 위한 ,
      4. // 각각의 work 개체 인스턴스는 db 테이블의 'Row' 해당하고,
      5. // Work 클래스의 속성들을 테이블의 'column' 맵핑된다.
      6. public int SEQ {get; set;}
      7. public string TYPES_ { get; set; }
      8. public string VERSIONS { get; set; }
      9. public string SUMMARY { get; set; }
      10. public string DETAILS { get; set; }
      11. public string Title { get; set; }
      12. public DateTime INITDAES { get; set; }
      13. public DateTime FINDATES { get; set; }
      14. public DateTime ReleaseDate { get; set; }
      15. public decimal YN { get; set; }
      16. }//Work

         

    2. 동일한 파일에 데이터베이스를 연결할 Context를 만든다.

 

  1. public class WorkDBContext : DbContext
  2. {
  3. // db에서 work 클래스의 인스턴스를 가져오고, 저장하고, 갱신하는 작업을 처리
  4. // Entity FrameWork로부터 제공되는 dbContext 기본클래스를 상속받는다.
  5. public DbSet<Work> Works { get; set; }
  6. }//WorkDBContext

 

  1. 연결 문자열 생성 및 SQL 서버 LocaDB 작업하기
    프로젝트의 Web.config 에서 다음과 같이 연결한다.

     

    1. <add name="WorkDBContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MvcMovies-20131008092844;Integrated Security=SSPI"
    2. providerName="System.Data.SqlClient" />

  

반응형

 

ASP.NET MVC 전달된 URL 기준으로 선택된 컨트롤러 클래스를 (그리고, 클래스에 존재하는 선택된 메서드를) 호출합니다. ASP.NET MVC 사용하는 기본 URL 라우팅 로직은, 실행할 컨트롤러와 메서드를 결정하기 위해서 다음과 같은 형태의 URL 사용합니다

   

View

Razor 엔진

 ASP.NET MVC 3에서 처음 도입된 Razor 엔진 사용해서 작성해 것입니다. Razor 기반의 템플릿은 .cshtml 이라는 파일 확장자를 갖고 있으며, C# 이용한 우아한 HTML 출력 생성 방식을 제공해줍니다. Razor 이용하면 템플릿 작성을 위해 필요한 글자수와 키입력을 최소화할 있으며, 빠르고 자연스러운 코딩이 가능해집니다

   

   

  1. _Layout.cshtml : 웹페이지에서 공통으로 사용되는 페이지 ( cf. 마스터 페이지)

상단의 로고 위치라던지, page 메뉴들을 공통으로 지정할 있다.

   

  1. Index.cshtml
반응형

+ Recent posts