Add project files.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class AdminMyProjectsEditVM
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
||||
public string image { get; set; }
|
||||
public string iframe { get; set; }
|
||||
public string title { get; set; }
|
||||
public string description { get; set; }
|
||||
public string TitleEN { get; set; }
|
||||
public string DescEN { get; set; }
|
||||
public string TitleTR { get; set; }
|
||||
public string DescTR { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Data.Entity;
|
||||
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class Context : DbContext
|
||||
{
|
||||
public Context() : base("Context")
|
||||
{
|
||||
// Fixes MODEL–DB uncompaciable:
|
||||
Database.SetInitializer<Context>(null);
|
||||
}
|
||||
|
||||
public DbSet<admin> admins { get; set; }
|
||||
public DbSet<myprojects> MyProjects { get; set; }
|
||||
public DbSet<myprojectstranslation> myprojectstranslations { get; set; }
|
||||
public DbSet<projectmedia> projectmedias { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
|
||||
namespace atakanozbancom
|
||||
{
|
||||
public class LanguageTR
|
||||
{
|
||||
public static List<Languages> AvailableLanguages = new List<Languages>
|
||||
{
|
||||
new Languages { LanguageFullName = "English", LanguageCultureName = "en-US" },
|
||||
new Languages { LanguageFullName = "Turkish", LanguageCultureName = "tr-TR" }
|
||||
};
|
||||
|
||||
public static bool IsLanguageAvailable(string lang)
|
||||
{
|
||||
return AvailableLanguages.Any(a => a.LanguageCultureName.Equals(lang, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public static string GetDefaultLanguage()
|
||||
{
|
||||
return AvailableLanguages[0].LanguageCultureName;
|
||||
}
|
||||
|
||||
public void SetLanguage(string lang)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsLanguageAvailable(lang))
|
||||
lang = GetDefaultLanguage();
|
||||
|
||||
var cultureInfo = new CultureInfo(lang);
|
||||
Thread.CurrentThread.CurrentUICulture = cultureInfo;
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureInfo.Name);
|
||||
|
||||
HttpCookie langCookie = new HttpCookie("culture", lang)
|
||||
{
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
HttpOnly = true
|
||||
};
|
||||
HttpContext.Current.Response.Cookies.Add(langCookie);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
public class Languages
|
||||
{
|
||||
public string LanguageFullName { get; set; }
|
||||
public string LanguageCultureName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class MyProjectsVM
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string title { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
public string image { get; set; }
|
||||
public string iframe { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class ProjectMediaVM
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
||||
public int projectid { get; set; }
|
||||
|
||||
public string mediatype { get; set; } // "image" or "iframe"
|
||||
|
||||
public string mediaurl { get; set; }
|
||||
|
||||
public int sortorder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class admin
|
||||
{
|
||||
[Key]
|
||||
public int id { get; set; }
|
||||
public string username { get; set; }
|
||||
public string password { get; set; }
|
||||
public List<myprojects> MyProjects { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
public class myprojects
|
||||
{
|
||||
[Key]
|
||||
public int id { get; set; }
|
||||
public string image { get; set; }
|
||||
public string iframe { get; set; }
|
||||
public string title { get; set; }
|
||||
[AllowHtml]
|
||||
public string description { get; set; }
|
||||
public string TitleEN { get; set; }
|
||||
public string DescEN { get; set; }
|
||||
public string TitleTR { get; set; }
|
||||
public string DescTR { get; set; }
|
||||
public object admins { get; internal set; }
|
||||
public virtual ICollection<myprojectstranslation> Translations { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace atakanozbancom.Models.classes
|
||||
{
|
||||
[Table("myprojectstranslations")]
|
||||
public class myprojectstranslation
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int project_id { get; set; }
|
||||
|
||||
[Required, StringLength(10)]
|
||||
public string culture { get; set; }
|
||||
|
||||
[StringLength(255)]
|
||||
public string title { get; set; }
|
||||
|
||||
public string description { get; set; }
|
||||
|
||||
[ForeignKey("project_id")]
|
||||
public virtual myprojects Project { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user