* Web.csproj:

* App.master:
* IModule.cs:
* IRenderer.cs:
* DataManager.cs:
* ITagHandler.cs:
* ViewRenderer.cs:
* ResultPages.cs:
* BBCodeHelper.cs:
* IViewRenderer.cs:
* Entity.cs:
* YavscModel.csproj:
* OAuth2.cs:
* Calendar.cs:
* Profile.aspx:
* ApiClient.cs:
* MapTracks.cs:
* SalesCatalog.csproj:
* EntityQuery.cs:
* AdminController.cs:
* BlogsController.cs:
* GoogleController.cs:
* SimpleJsonPostMethod.cs:
* JsonReaderError.cs:
* AccountController.cs:
* JsonReaderError.aspx:
* GoogleErrorMessage.cs:
* GoogleErrorMessage.aspx: 

* Catalog.cs: refactoring

* Makefile: preprod is from local domain, and prod is for
  lua.pschneider.fr
This commit is contained in:
Paul Schneider 2015-01-21 18:50:02 +01:00
commit 8301159645
29 changed files with 969 additions and 314 deletions

View file

@ -229,19 +229,21 @@ namespace Yavsc.Controllers
{
string username = Membership.GetUser ().UserName;
ViewData ["UserName"] = username;
if (AvatarFile != null) {
if (AvatarFile == null) {
// do not update <c>avatar</c> to null since
// it's not in the model.
}
else {
// if said valid, move as avatar file
// else invalidate the model
if (AvatarFile.ContentType == "image/png") {
string avdir = Server.MapPath (AvatarDir);
string avpath = Path.Combine (avdir, username + ".png");
AvatarFile.SaveAs (avpath);
string avuri = avpath.Substring (
AppDomain.CurrentDomain.BaseDirectory.Length);
avuri = avuri.Replace (" ", "+");
avuri = Request.Url.Scheme + "://" + Request.Url.Authority + "/" + avuri;
HttpContext.Profile.SetPropertyValue ("avatar", avuri);
HttpContext.Profile.Save ();
model.avatar = avuri;
model.avatar =
Path.Combine(AvatarDir.Substring(1),username)+".png";
} else
ModelState.AddModelError ("Avatar",
string.Format ("Image type {0} is not supported (suported formats : {1})",