| Define Helper Classes |
| There are several Helper classes in MVC frame work. 1.Form Helper- Radio buttons, textboxes,list boxes etc. 2.URL helpers 3.HTML helpers- Encode, Decode, AttributeEncode, and RenderPartial. |
Define Helper Classes
Labels:
MVC
Define Non-Action Methods
| Define Non-Action Methods |
|
Labels:
MVC
Define Action Methods Parameters
| Define Action Methods Parameters |
|
Labels:
MVC
Define MVC Attributes
| Define MVC Attributes |
|
Labels:
MVC
Define ActionResult Return Type
| Define ActionResult Return Type |
|
Labels:
MVC
Define Action methods
| Define Action methods |
|
Labels:
MVC
Define Types of Action Filters
| Define Types of Action Filters |
| 1. Authorization filters Implements the IAuthorizationFilter attribute. This filter is always executed first. 2. Action filters Implements the IActionFilter attribute. You can use this filter to modify the viewdata that an action returns. 3. Result filters Implements the IResultFilter attribute. Eg You might want to modify the view result before view is redered to the browser. 4. Exception filters Implements the IExceptionFilter attribute. Can be used to log errors, raised by your controller action or controller action results. |
Labels:
MVC
Use Row_number() in SQL Server
SQL Scenario -I
Table A Table B
Id Id
1 1
2 -
- 3
4 4
Expected Output:
Id Description
1 1 Has both in tables
2 2 Has in A table Only
3 3 Has in B table Only
4 4 Has both in tables.
Table A Table B
Id Id
1 1
2 -
- 3
4 4
Expected Output:
Id Description
1 1 Has both in tables
2 2 Has in A table Only
3 3 Has in B table Only
4 4 Has both in tables.
create view UV_Result
as
select a.id,a.id + ' ' + 'Has both in tables' as [DESCRIPTION] from table1 a,table2 b where a.id=b.id and a.id<>'-'
as
select a.id,a.id + ' ' + 'Has both in tables' as [DESCRIPTION] from table1 a,table2 b where a.id=b.id and a.id<>'-'
Create view UV_TestA
as
select Distinct id as [TableAID],
RowNum = row_number() OVER (ORDER BY (SELECT 0))
from table1 a
as
select Distinct id as [TableAID],
RowNum = row_number() OVER (ORDER BY (SELECT 0))
from table1 a
Create view UV_TestB
as
select id,
RowNum = row_number() OVER (ORDER BY (SELECT 0))
from table2
as
select id,
RowNum = row_number() OVER (ORDER BY (SELECT 0))
from table2
create view uv_Final
as
select id,DESCRIPTION from UV_Result
union ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE B' from UV_TestA where TableAId='-'
UNION ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE A' from UV_TestB where Id='-'
as
select id,DESCRIPTION from UV_Result
union ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE B' from UV_TestA where TableAId='-'
UNION ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE A' from UV_TestB where Id='-'
select * from uv_Final order by id
Labels:
SQL Server
Define MVC Action Filters
| Define MVC Action Filters |
| Action Filters are used in cases where we need to perform some logic either before an action method is called or after an action method runs. |
Labels:
MVC