goo.gl/RFY5C2 : Subscribe to CodAffection goo.gl/DSSHtV : Mvc CRUD Operation Using Pop Up Windows goo.gl/zkoWSg : jQuery Ajax CRUD in Asp.Net MVC goo.gl/bPcyXW : Buy me a Coffee
i got lost on 17:38 because i couldn't find the reference to ReadAsAsync 'System.Net.Http.HttpContent' does not contain a definition for 'ReadAsAsync' and no extension method 'ReadAsAsync' accepting a first argument of type 'System.Net.Http.HttpContent' could be found (are you missing a using directive or an Assembly reference?)
Instead of : webAPIClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json)")); USE: webAPIClient.DefaultRequestHeaders.Add("Accept", "application/json;odata=verbose"); It works!
The best tutorial I've seen, good job you example is the best example I've seen, only I some question, can I use a Web Services with Entity Framework action ? if you have any example for this kind problem is a good idea you try to explain, my second question is when I made my CRUB I have a item of datetime type, I use a datepicker but I have a problem whit the day when the day is major or equal to 13, I save the day in this format "mm/dd/yy" but when I recive the day in my controller I recive a parameter null, Why can you explain me this please? what I need to do for fix this problem; my last question is How to remove the hour in a field datetime, thank you
seems that your date and month are mixed up. Your computer may be receiving in USA format "mmddyyyyy" and the control might be sending in english format "ddmmyyyy" or vice versa.
@17:55 i got the following error. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. what to do?
Hey , i am getting error at 39:52 for edit operation : Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly please help me!
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly Error is coming
great tutorial , i never found like this one, if we have knowledge on concept we never feel work pressure, keep doing more videos, my humble request is to do a video on django framework similary by taking like this small project , thanks a lot
thanks for sharing your thoughts here. I'm working on my python. hopefully django framework tutorial are on the way. I would be waiting for your feedback once it is done.
Line 18: empList = response.Content.ReadAsAsync().Result; . Error: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Mvc.Models.mvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. Please Fix it.
Solution: Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies folder. The method ReadAsAsync is an extension method declared in the class HttpContentExtensions, which is in the namespace System.Net.Http in the library System.Net.Http.Formatting. Reflector came to rescue!
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[employeeMVC.Models.MvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Message', line 1, position 11. Im getting an error like this anyone can help
Hi, I am getting exception, Server Error in '/' Application. Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebApiInMVC.Models.EmployeeMVC]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Message', line 1, position 11. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebApiInMVC.Models.EmployeeMVC]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Message', line 1, position 11. Source Error: Line 17: IEnumerable empList; Line 18: HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result; Line 19: empList = response.Content.ReadAsAsync().Result; Line 20: return View(empList); Line 21: } Please help me to resolve this. Thnaks in advance!
I can't call the HTTP method from the WebAPI project in my WebApp thorugh implementing the insert operation" in my WebApp employee controller. I cannot define the GlobalVariables (it doesn't show up). I assume it is because my WebAPI project (which in my case communicates with my MS SQL server db using EF Migrations) is a separate solution from the WebApp. You seem to have both the WebAPI and the Website in 1 solution. Any advice?
I have tried multiple of time the same code you have written, but it threw exception : System.Net.Http.UnsupportedMediaTypeException: 'No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'.'
Very helpful video,i liked very much.Please upload more videos on asp.net mvc. Q1.How to use dapper in web Api with repository model ? Plz help me out.
Nice explanation for startup! Css doesn't work have copied from project download link, but for my case Create New open in same window itself not as popup. Please help.
very help full video but i found error 'No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'. can u help?? '
Hi, step 1 is to add the "/" forward slash at the end of your link: Uri("localhost:54485/api/"); Step 2 is to install IIS Express, then it should work just fine. Happy programming mate! :-)
Hello i reslove this error suceessfully , you just need to correct port number => new Uri("localhost:44345/api/"); here 44345 is api port number in your localhost just like in your local webapi project mention correct port number and it will work..........
in index.cshtml class some error showing System.NullReferenceException: 'Object reference not set to an instance of an object.' excepation Throw can you tel how can i short out this error
@CodAffection can you please share which nuget packages you have added in WebApi & Mvc, coz after completing project data is not updating & deleting from front end. Or anyone can please. Preparing for interview.
salonList = response.Content.ReadAsAsync().Result; = An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code ??
Solution: Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies folder. The method ReadAsAsync is an extension method declared in the class HttpContentExtensions, which is in the namespace System.Net.Http in the library System.Net.Http.Formatting. Reflector came to rescue!
Hello can anyone please help me with this error : 'object' doesnot contain a definition for 'result' and no accessible extension method 'result' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
How to resolve in your code Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebAppMVC.Models.mvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Message', line 2, position 13.
I have an error when i build the both project as startup.. The error is "program does not contain a static 'main' method suitable for an entry point"..The error in web api project in the CS File. I search a lot but did not find the solution, Anyone please help..
JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[ImsMVC.Models.mvcProductmodel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Message', line 1, position 11.
Hi Sir, your video is extremely helpful for beginers in mvc and web api. Could you please explain how to add a 'file upload' field to the Add or Edit view? Normal code in httpPost action IN THE CONTROLLER is not working.Please help
Can you please share which nuget packages you have added in WebApi & Mvc, coz after completing project data is not updating & deleting from front end. Or anyone can please. Preparing for interview.
This is very helpful tutorial. I have used this as reference for me practice. In my database I have two tables like project and costcenter. Costcenter having project as foreign key. Now how I can create screens for this.
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly pls help
Hi, i had found this same error when the table Employee has truncated and i populate the table Employee again with the same script of the tutorial and after run the application again it works fine.
@@thiagocolares3181 It was giving me the same error when I tried to run the project @ : about 18:50 of the video "Cannot deserialize the current JSON object..." Here is the code that I used to fix it: public ActionResult Index() { IEnumerable empList; HttpResponseMessage response = GlobalVariables.WebAPIClient.GetAsync("Employees").Result; empList = response.Content.ReadAsAsync().Result; return View(empList);
} Notice I had to use ""Employees" instead of "Employee" inside of the ( ) on the fourth line of code. Using "Employee" gave me the same error. Also I truncated the Employee table in SSMS as well..just to be safe but I don't know if that made any difference. I hope this helps.
I am getting error on timestamp: 09:28 of your video. Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Unexpected error occurred inside a LocalDB instance API method call. See the Windows Application event log for error details. )
i love this tutorial can you make another video again with selection box and dropdown list,radio button in one form in asp.webapi crud operation using mvc and entity frameworks. And have nav bar for the operations?
Followed the tutorial, Thank You! One issue I am having, is that I cannot see the values stored in the DB with the api/{controller} link. It doesn't give an error message besides "No HTTP Resource was found that matches the request URI." I checked the controller and referenced it with yours, and everything checks out. What could I have missed? Thank you!
I had the same issue - firstly make sure your table in DB is populated. Secondly make sure you are referencing the correct controller name. Another things - are your methods returning Views (if yes - then this is wrong). Just paste whatever you have on top of the method after Get/Post/etc epi/{controllerAction}
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Mvc.Models.MvcEmployee]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. I go this error. My controller was named EmployeesController, thus my was also /Employees so I changed this HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result; to this HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employees").Result; and worked for me.
for some reason I encountered an error while doing this project when I type localhost:60502/Employee in the browser,. it shows the following error.. I don't know what's the issue.. Server Error in '/' Application. No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Http.UnsupportedMediaTypeException: No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'. Source Error: Line 16: IEnumerable empList; Line 17: HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result; Line 18: empList = response.Content.ReadAsAsync().Result; Line 19: return View(empList); Line 20: } Source File: C:\Users\EdgeTech1\source epos\WebApi\Mvc\Controllers\EmployeeController.cs Line: 18 Stack Trace:
I had this error and it was because I had the wrong URI in GlobalVariables. Make sure your URI is pointing to the Web API. You can get your project URI by right clicking on WebAPI project -> Properties -> Web.
hi sir , this is very useful tutorial , but i am gating error on globelverials sigment public static class GloBalVariables { public static HttpClient WebClient = new HttpClient(); GloBalVariables() { } } Error CS0710 Static classes cannot have instance constructors MVc Error CS0117 'GloBalVariables' does not contain a definition for 'SetWebApiClient' MVc ithink some files version are different because i am using vs2017 please give me a any solution
Hi Sir When we run this is Application then error is Show on Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVCPro.Models.Employee]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JS pls help me why i m geting error during run this application
COULD SOMEONE HELP ME? On minute 19:28 I have an exception error: "JsonSerializationException: Cannot deserialize the current JSON object..." The error occurs on the line: empList = response.Content.ReadAsAsync().Result;
empList = response.Content.ReadAsAsync().Result; Error in this line ERROR MESSSAGE: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1
I tried to download this video many times....but its downloading in low quality, i am not able to understand with that quality...help me to download 720px quality instead of 360px
goo.gl/RFY5C2 : Subscribe to CodAffection
goo.gl/DSSHtV : Mvc CRUD Operation Using Pop Up Windows
goo.gl/zkoWSg : jQuery Ajax CRUD in Asp.Net MVC
goo.gl/bPcyXW : Buy me a Coffee
i got lost on 17:38 because i couldn't find the reference to ReadAsAsync
'System.Net.Http.HttpContent' does not contain a definition for
'ReadAsAsync' and no extension method 'ReadAsAsync' accepting a
first argument of type 'System.Net.Http.HttpContent' could be
found (are you missing a using directive or an Assembly reference?)
Thank you so much. Now I know how to use API in MVC Project using Entity Framework. Thumbs Up👍
Instead of : webAPIClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json)"));
USE:
webAPIClient.DefaultRequestHeaders.Add("Accept", "application/json;odata=verbose");
It works!
Just 45min and two technologies are done. Best one 👌👌👌👌
thanks for the wonderful feedback.
what a great tutorial, you have helped me a lot, it's the best tutorial I've seen, thank you very much!!
thanks for the comment. Glad you found the video helpful.
If you have any topic to be discussed related to Web API or ASP.NET MVC, please reply here.
The best tutorial I've seen, good job you example is the best example I've seen, only I some question, can I use a Web Services with Entity Framework action ? if you have any example for this kind problem is a good idea you try to explain, my second question is when I made my CRUB I have a item of datetime type, I use a datepicker but I have a problem whit the day when the day is major or equal to 13, I save the day in this format "mm/dd/yy" but when I recive the day in my controller I recive a parameter null, Why can you explain me this please? what I need to do for fix this problem; my last question is How to remove the hour in a field datetime, thank you
seems that your date and month are mixed up. Your computer may be receiving in USA format "mmddyyyyy" and the control might be sending in english format "ddmmyyyy" or vice versa.
In a Simple way, you explained
Thank u so much
Outstanding tutorial, pretty straightforward and clear.
Thank you for sharing your knowledge.
Greetings from Guatemala!! New subscriber here!!
It is really helpful for all beginner.Thank you so much.
No doubt, preety straight and simple example to understand Web API CRUD
thanks for your wonderful feedback !.
One of the best tutorials ever.
Indeed
It was one of my most precious 45 minutes. Thank you :)
Glad to hear that.
Great job....i liked to learn mvc from ur tutorials videos...i am a beginner and i am expecting more realtime examples like this.....
thanks for the comment
Thank you so much !! Kindly upload three tier architecture in web api. Please.
@17:55
i got the following error.
not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
what to do?
did you got the error ??
Superbly explained each steps, Great work. Can you please help me that how to use stored procedures using entity framework in web api?
Hey , i am getting error at 39:52 for edit operation : Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly
please help me!
me too bro
Absolutely what I needed. Thanks so much 👍🏻
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly
Error is coming
Same Error In my application :(
Add web api employee class name in the following line GlobalVariables.WebApiClient.GetAsync("Employees").Result
@@shubhamaditya7481 Thanks bro
@@shubhamaditya7481 Can you tell me where, I don't understand where I nedd to add? Please :(
@@shubhamaditya7481 Obrigado, me ajudou muito
great tutorial , i never found like this one, if we have knowledge on concept we never feel work pressure, keep doing more videos, my humble request is to do a video on django framework similary by taking like this small project , thanks a lot
thanks for sharing your thoughts here.
I'm working on my python. hopefully django framework tutorial are on the way.
I would be waiting for your feedback once it is done.
Really its very helpful vedio using CURD opertion using web api..thanks.
glad you found the video helpful.
Line 18: empList = response.Content.ReadAsAsync().Result;
.
Error: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Mvc.Models.mvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
Please Fix it.
Solution: Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies folder.
The method ReadAsAsync is an extension method declared in the class HttpContentExtensions, which is in the namespace System.Net.Http in the library System.Net.Http.Formatting.
Reflector came to rescue!
I like that you show the result before the bullshit that I have to learn
Very helpful tutorial with apt explanation. Thanks
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[employeeMVC.Models.MvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'Message', line 1, position 11.
Im getting an error like this anyone can help
Hi,
I am getting exception,
Server Error in '/' Application.
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebApiInMVC.Models.EmployeeMVC]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'Message', line 1, position 11.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebApiInMVC.Models.EmployeeMVC]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'Message', line 1, position 11.
Source Error:
Line 17: IEnumerable empList;
Line 18: HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result;
Line 19: empList = response.Content.ReadAsAsync().Result;
Line 20: return View(empList);
Line 21: }
Please help me to resolve this.
Thnaks in advance!
I followed the video and finished very well. You have helped me a lot, the best tutorial I've seen, I love CodAffection.
thanks for your kind words.
Hi I have one doubt... If you create table foreign key table data also.
How to restrict this?
This video is awesome,really helpful. Thank you
wonderful. this tutorial is very helpful, understandable and well explained. great job
So many adds, overal it's very easy to understand.
Good help full example of Crud operation. Thanks
Glad you found the video helpful.
I can't call the HTTP method from the WebAPI project in my WebApp thorugh implementing the insert operation" in my WebApp employee controller. I cannot define the GlobalVariables (it doesn't show up). I assume it is because my WebAPI project (which in my case communicates with my MS SQL server db using EF Migrations) is a separate solution from the WebApp. You seem to have both the WebAPI and the Website in 1 solution. Any advice?
Great tutorial, no doubt about it.
But one question to ask
How to connect Oracle database instead of SQL ?
Huge respect
Thanks for your wonderful feedback.
Great tutorial! Please keep uploading on such informative topics. Thank you
sure, thanks for the support.
Very useful and great explanation sir . thank you please upload more videos.
sure :)
I have tried multiple of time the same code you have written, but it threw exception :
System.Net.Http.UnsupportedMediaTypeException: 'No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'.'
Did u solved that error
Very helpful video,i liked very much.Please upload more videos on asp.net mvc.
Q1.How to use dapper in web Api with repository model ? Plz help me out.
Dapper ORM in Asp.net MVC : ua-cam.com/video/bKB0TV_XbLA/v-deo.html
having error at 30:57
Error CS1503 Argument 2: cannot convert from 'MVC.Models.mvcEmployeeModel' to 'System.Net.Http.HttpContent' MVC
Nice explanation for startup! Css doesn't work have copied from project download link, but for my case Create New open in same window itself not as popup. Please help.
Very nice for beginners. Thanks for this awesome tutorial.
My pleasure.
Thank you very much for you are providing this important information
Fantastic man, very nicely explained. Thanks
This helped me alot. Thanks
very help full video but i found error 'No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'. can u help??
'
Hi, step 1 is to add the "/" forward slash at the end of your link: Uri("localhost:54485/api/"); Step 2 is to install IIS Express, then it should work just fine. Happy programming mate! :-)
@@mikelaw5700 I can't believe it. :)
Hello i reslove this error suceessfully , you just need to correct port number => new Uri("localhost:44345/api/"); here 44345 is api port number in your localhost just like in your local webapi project mention correct port number and it will work..........
This is what I'm looking for. Just subcribed and iked... thanks man! :)
Thanks man.
Thank you so much for giving more information.......
I have good support for this video...
thanks for your wonder full feedback.
Hey dude, thanks a lot. Awesome video, great tutorial. It was so useful to me. And from scratch. THANKS!!! :)
glad you found it helpful.
in index.cshtml class some error showing System.NullReferenceException: 'Object reference not set to an instance of an object.'
excepation Throw
can you tel how can i short out this error
Thanks for giving more information in webapi curd operations......
you are welcome.
Hello ,
can you add login and logout to this application?
My friend, how do you create a constructor in the static class GlobalVariables? Is possible that?
error is static classes cannot have instance constructors.how can i slove this
@@nareshkumar-kf7te static GlobalVariables() { }
@CodAffection can you please share which nuget packages you have added in WebApi & Mvc, coz after completing project data is not updating & deleting from front end. Or anyone can please. Preparing for interview.
Why are we converting id.tostring() in mvc for calling getemployee(id) from api?
Thank you very helpful.
salonList = response.Content.ReadAsAsync().Result; = An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code ??
Solution: Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies folder.
The method ReadAsAsync is an extension method declared in the class HttpContentExtensions, which is in the namespace System.Net.Http in the library System.Net.Http.Formatting.
Reflector came to rescue!
// GET: Employee
public async Task Index()
{
HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employees").Result;
var responseContent = await response.Content.ReadAsStringAsync();
var Employees = JsonConvert.DeserializeObject(responseContent);
return View(Employees);
}
***Try this one, this works****
@@AMRashedMahamud1320 ty so much!!!!
The best video on this topic. Thank u!
thanks for tuto.. Good job. I think 142k views and just 1k likes is injustice.
Thanks for the wonderful comment.
Hello can anyone please help me with this error : 'object' doesnot contain a definition for 'result' and no accessible extension method 'result' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
How to resolve in your code
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[WebAppMVC.Models.mvcEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'Message', line 2, position 13.
Thank u v.much , please need authurization and authintication, access rights
I have an error when i build the both project as startup.. The error is
"program does not contain a static 'main' method suitable for an entry point"..The error in web api project in the CS File.
I search a lot but did not find the solution, Anyone please help..
Thank you, great tutorial.
Hi for some reason when i submit the form, the values are not getting added in the database
stunning crud operations sir.
thanks for the kind words.
@@CodAffection I am getting socket exception : connect was forcibly closed .. please help me how to resolve
JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[ImsMVC.Models.mvcProductmodel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'Message', line 1, position 11.
If suppose their are 11 table then we need to create 11 controllers in mvc and in api also?
Hi Sir, your video is extremely helpful for beginers in mvc and web api. Could you please explain how to add a 'file upload' field to the Add or Edit view? Normal code in httpPost action IN THE CONTROLLER is not working.Please help
Can you please share which nuget packages you have added in WebApi & Mvc, coz after completing project data is not updating & deleting from front end. Or anyone can please. Preparing for interview.
super explain web api crud operation . but set icons not clear that part .
Did you make Reset button to work?
This is very helpful tutorial. I have used this as reference for me practice. In my database I have two tables like project and costcenter. Costcenter having project as foreign key. Now how I can create screens for this.
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVC.Models.MVCEmployeeModel]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly
pls help
Hi, i had found this same error when the table Employee has truncated and i populate the table Employee again with the same script of the tutorial and after run the application again it works fine.
@@thiagocolares3181 It was giving me the same error when I tried to run the project @ : about 18:50 of the video "Cannot deserialize the current JSON object..."
Here is the code that I used to fix it:
public ActionResult Index()
{
IEnumerable empList;
HttpResponseMessage response = GlobalVariables.WebAPIClient.GetAsync("Employees").Result;
empList = response.Content.ReadAsAsync().Result;
return View(empList);
}
Notice I had to use ""Employees" instead of "Employee" inside of the ( ) on the fourth line of code. Using "Employee" gave me the same error. Also I truncated the Employee table in SSMS as well..just to be safe but I don't know if that made any difference. I hope this helps.
@@New2Hackintosh thank you!!!
@@New2Hackintosh hey i am getting same error in EDIT operation how to solve it ?
@@New2Hackintosh Thank you. The ("Employees") saved my ass
I am getting error on timestamp: 09:28 of your video.
Error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Unexpected error occurred inside a LocalDB instance API method call. See the Windows Application event log for error details.
)
Please check this post : stackoverflow.com/a/1393125/4133590
i love this tutorial can you make another video again with selection box and dropdown list,radio button in one form in asp.webapi crud operation using mvc and entity frameworks. And have nav bar for the operations?
Followed the tutorial, Thank You!
One issue I am having, is that I cannot see the values stored in the DB with the api/{controller} link. It doesn't give an error message besides "No HTTP Resource was found that matches the request URI."
I checked the controller and referenced it with yours, and everything checks out.
What could I have missed?
Thank you!
I had the same issue - firstly make sure your table in DB is populated. Secondly make sure you are referencing the correct controller name. Another things - are your methods returning Views (if yes - then this is wrong). Just paste whatever you have on top of the method after Get/Post/etc epi/{controllerAction}
Thank you so much from Vietnam
Hi, thanks for this turorial, but there is a mistake in class GlobalVariable, because Static classes cannot have instance constructors. Greetings.
Thanks for the info!
Wow. great 👌. Thank you so much 💖
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Mvc.Models.MvcEmployee]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
I go this error.
My controller was named EmployeesController, thus my was also /Employees
so I changed this
HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result;
to this
HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employees").Result;
and worked for me.
for some reason I encountered an error while doing this project
when I type localhost:60502/Employee in the browser,. it shows the following error..
I don't know what's the issue..
Server Error in '/' Application.
No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Http.UnsupportedMediaTypeException: No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'.
Source Error:
Line 16: IEnumerable empList;
Line 17: HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Employee").Result;
Line 18: empList = response.Content.ReadAsAsync().Result;
Line 19: return View(empList);
Line 20: }
Source File: C:\Users\EdgeTech1\source
epos\WebApi\Mvc\Controllers\EmployeeController.cs Line: 18
Stack Trace:
I had this error and it was because I had the wrong URI in GlobalVariables. Make sure your URI is pointing to the Web API. You can get your project URI by right clicking on WebAPI project -> Properties -> Web.
@@stevensnow2089 yes and thanks for your reply. It worked after I put / in baseaddress.
hi sir , this is very useful tutorial ,
but i am gating error on globelverials sigment
public static class GloBalVariables
{
public static HttpClient WebClient = new HttpClient();
GloBalVariables()
{
}
}
Error CS0710 Static classes cannot have instance constructors MVc
Error CS0117 'GloBalVariables' does not contain a definition for 'SetWebApiClient' MVc
ithink some files version are different because i am using vs2017
please give me a any solution
Great tutorial, but i have one question about your post obj, how can i make it accept post array obj?
Thanks for the demonstration.
thank you so much, Master!!! take care...
Nice Lecture. But when you pronounce Table I wanna know where you learn how to say Table.
Great Work man , huge thanks , seriously !
Glad you found the video helpful.
hi, may i know about the database, do we need to do another project or still in the same solution with mvc and dummy project?
Thanks bro! very helpful!
Is this able to do it with a windows form app? Thank you!
Great Tutorial Man Awesome Job!
Glad you found the video helpful.
Thank u for this video..helped a lot
What do you think about the use of Migration database and can you explain
Hi
Sir
When we run this is Application then error is Show on
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[MVCPro.Models.Employee]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JS
pls help me why i m geting error during run this application
I'm also facing this issue
Good tutorial, but feedback, wait for sometime, before switching the tabs i am getting confused
COULD SOMEONE HELP ME?
On minute 19:28 I have an exception error: "JsonSerializationException: Cannot deserialize the current JSON object..."
The error occurs on the line:
empList = response.Content.ReadAsAsync().Result;
did you tried this : stackoverflow.com/a/21885758/4133590
For delete why we are writing method in javascript as well as in controller action method ?
yes, you can directly call to Web API method instead of mvc action method. if you don't have any thing to do in mvc. happy coding.
Alguien que me pueda ayudar con la parte de la funcionalidad del Delele... el alertity no me aparece y la funcion del Delete no hace nada!!!
empList = response.Content.ReadAsAsync().Result;
Error in this line
ERROR MESSSAGE:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1
I tried to download this video many times....but its downloading in low quality, i am not able to understand with that quality...help me to download 720px quality instead of 360px
awasome bro explain very well