Error Message:
The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Receivers/Create
I have create view in Receivers Folder. I have checked the spelling. it's correct but the create page doesn't show.
The code is below.
@model IEnumerable<BBProjectnew.Models.Receivers.Receiver>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
My controller code as follows.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create(ReceiverCreationModel model)
{
if (ModelState.IsValid)
{
await receiverService.CreateReceiver(model);
}
return RedirectToAction("Index");
}
My ReceiverService code as follows
public async Task CreateReceiver(ReceiverCreationModel model)
{
DbContext.Receivers.Add(Mapper.Map<ReceiverCreationModel, Receiver>(model));
await DbContext.SaveChangesAsync();
}
public Receiver ReceiverDetails(int id)
{
return DbContext.Receivers.SingleOrDefault(d => d.ReceiverId == id);
}