c# - HttpStatusCodeResult namespace not found -
namespace not recognized in class library project (eventservice.cs) when use in controller (mvc project) works fine , adds assembly properly:
using system.net;
here code eventservice.cs
(class library project serves interface controller)
public event geteventbyid(int? id) { if (id == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } var @event = (from u in db.event u.eventid == id select u).firstordefault(); if (@event == null) { return httpnotfound(); } return @event; }
i've tried deleting bin , obj folder in projects , rebuild - no luck.same code works ok in mvc projects.
the httpstatuscoderesult part of system.web.mvc namespace. reference if have added mvc in project.
here can find more details: https://msdn.microsoft.com/en-us/library/system.web.mvc.httpstatuscoderesult(v=vs.118).aspx
Comments
Post a Comment