* ICalendarManager.cs: WIP booking TODO a calendar provider * NpgsqlProfileProvider.cs: Fixes the defaultValue specification from config file * BlogsController.cs: * AccountController.cs: * CalendarController.cs: refactoring : the Yavsc controller name * instdbws.sql: a new profile value : a boolean, `AllowCookies` :'{ * style.css: a class to display notification * HomeController.cs: Notifies users this site uses cookies (what for an information!) If authenticated, at dimissing this notification, the user's profile is updated, and he'll not mess up anymore with the info. * App.master: * YavscHelpers.cs: adds usage of click_action value at displaying a notification. * yavsc.js: Implements the notification `click_action` * Web.config: * enables anonymous profiles * adds a new `allowcookies` profile property * Web.csproj: Yavsc controller refactoring * YaEvent.cs: * IFreeDateSet.cs: WIP booking * LocalizedText.resx: * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: implements the message "uses cookies" * YavscModel.csproj: refactoring * Notification.cs: The Yavsc otification will start as a Google one ... many properties are not yet used, but all seems usefull. * Web.config: code prettying * YavscController.cs: Gives Yavsc a concrete base controller
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
//
|
|
// YavscApiController.cs
|
|
//
|
|
// Author:
|
|
// Paul Schneider <paul@pschneider.fr>
|
|
//
|
|
// Copyright (c) 2015 GNU GPL
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
using System;
|
|
using System.Web.Http;
|
|
using System.Net.Http;
|
|
using System.Web.Profile;
|
|
|
|
namespace Yavsc.ApiControllers
|
|
{
|
|
public class YavscController : ApiController
|
|
{
|
|
public YavscController ()
|
|
{
|
|
}
|
|
public class Auth {
|
|
public string Id { get; set; }
|
|
}
|
|
|
|
public void AllowCookies (Auth model)
|
|
{
|
|
if (model.Id != null) {
|
|
ProfileBase anonymousProfile = ProfileBase.Create (model.Id);
|
|
anonymousProfile.SetPropertyValue ("allowcookies", true);
|
|
}
|
|
}
|
|
|
|
protected HttpResponseMessage DefaultResponse()
|
|
{
|
|
return ModelState.IsValid ?
|
|
Request.CreateResponse (System.Net.HttpStatusCode.OK) :
|
|
Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
|
|
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
|
|
}
|
|
}
|
|
}
|
|
|