public HttpResponseMessage CreateEntry(Entry e) { try { /* we're taking in an entry, and want to update the basics */ e.CreatedOnDate = DateTime.UtcNow; e.CreatedByUserId = -1; e.LastModifiedOnDate = DateTime.UtcNow; e.LastModifiedByUserId = -1; /* if we don't have a moduleId coming in, let's look it up */ if (e.ModuleId < 1) { //look up module var mc = new ModuleController(); var mi = mc.GetModuleByDefinition(0, "VehiDataCollector"); //TODO: assuming PortalId=0 if moduleid =0 if (mi != null) { e.ModuleId = mi.ModuleID; } } var vc = new EntryController(); vc.CreateEntry(e); return(Request.CreateResponse(HttpStatusCode.OK, "valid")); } catch (Exception exc) { DnnLog.Error(exc); //todo: obsolete return(Request.CreateResponse(HttpStatusCode.BadRequest, "error in request")); //todo: probably should localize that? } }
public HttpResponseMessage CreateEntry(int vehicleId, string entryName, string entryDescription, string entrySource) { try { var e = new Entry(); e.EntryName = entryName; e.EntryDescription = entryDescription; e.EntrySource = entrySource; e.CreatedOnDate = DateTime.UtcNow; e.CreatedByUserId = -1; e.LastModifiedOnDate = DateTime.UtcNow; e.VehicleId = vehicleId; var vc = new EntryController(); vc.CreateEntry(e); return(Request.CreateResponse(HttpStatusCode.OK, "valid")); } catch (Exception exc) { DnnLog.Error(exc); //todo: obsolete return(Request.CreateResponse(HttpStatusCode.BadRequest, "error in request")); //todo: probably should localize that? } }