TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mike idowu
1.3k
448
63.9k
Export to Excel using ViewModel and Repository - ASP.NET MVC
Dec 31 2017 12:58 PM
I have this model
and ViewModel
I want to export to Excel using ViewModel and Repository. Initially, I have used my Model Class and Repository, and it was working fine. But I want to change it to ViewModel and Repository.
From the attached code, ExcelCode1 is the initial code I used that worked. How do I perform it using ViewModel.
How do I include ViewModel.
I tried to create a service as shown below and call from the controller, but dont know how to go about it.
ViewModel
public class CountriesViewModel
{
[HiddenInput]
public int COUNTRY_ID { get; set; }
[Required(ErrorMessage = "Country Code is required")]
[Display(Name = "Country Code")]
[StringLength(2, ErrorMessage = "The {0} must be at least {1} characters long. Plese check again!", MinimumLength = 2)]
public string COUNTRY_CODE { get; set; }
[Required(ErrorMessage = "Country Name is required")]
[Display(Name = "Country Name")]
[StringLength(100, ErrorMessage = "The {0} must be at least {1} characters long. Plese check again!", MinimumLength = 2)]
public string COUNTRY_NAME { get; set; }
}
Attachment:
ExcelCode1.zip
Reply
Answers (
1
)
Interface reference varibles.
A generic error occurred in GDI error when save bar code ima