Esempio n. 1
0
        public string GetAvatar()
        {
            var model = new PersonalDataViewModel();

            if (string.IsNullOrEmpty(model.Avatar))
            {
                return
                    "data:image/jpg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAUAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQAAgICAgICAgICAgMCAgIDBAMCAgMEBQQEBAQEBQYFBQUFBQUGBgcHCAcHBgkJCgoJCQwMDAwMDAwMDAwMDAwMDAEDAwMFBAUJBgYJDQsJCw0PDg4ODg8PDAwMDAwPDwwMDAwMDA8MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgBDgEOAwERAAIRAQMRAf/EAIAAAQEAAwEBAQEAAAAAAAAAAAACAQMGBwUECQEBAAAAAAAAAAAAAAAAAAAAABAAAgEDAgQCBQgHBgcAAAAAAAECEQMEMQUhQRIGUWFxgZEiE6GxwTJCcjMU0VKistIjU2KCksKjFvBDsyQ0VFURAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AP66AAAAAAAAAAAAAAAAM0fgBnpAdPmBnpQGOkB0+YGOlgKMDAAAAAAAAAAAAAAAAAAAAAAAAAAAZSbAz0gUAAAAAAAAAAYogMdPgBIAAAAAAAAAAAAAAAAAAAAAGUqgUkBkABmjAz0gZ6UAovADNF4AKLwAxRAY6QMdLAwAAAS4+AEgAAAAAAAAAAAAAAAAADKVQLAAZSqBVEBkBQDPSwM9PmA6fMB0+YDpAxRgYAAS4gTSgADDVQJaoBgAAAAAAAAAAAAAACkubAoABaVAMgZSYG21ZndnG1atyu3JukIRVW35JAdlgdnZN5RuZ95YsXx+DBdU6eb0XygdPY7X2axSuM78l9q7Jv5FRfIB9CO0bVHTbcb12oP50BM9m2mda7djqv6tuMfmSA+ZkdpbReT+HC5iyejtzbVfRKoHJ7j2nn4ilcxms60tVBUuJfd419TA5ZpxbTTTTo09UwMAT0gYaoBgCWvACQGoENUAwAAAAAAAAAAAAFJc2BQGUq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AAAAAAAAAAAAAAAAAAAAAw2kqt0S1bA/Fd3TbbH42fj234O5GvsrUDlu4O4NoydrzMOxlq9fvRShGMZUqpJ/WpTl4geXAAAAAAAAAAADKbi002mtGgP3Wt13OxT4W4ZEEvsq5KnsrQD6VvunfbWmc5rwnCEvlcagfvt97bxD68Me8ufVCSf7MkB+2HfmSvxdvtT+7OUfnUgP2Q78sP8AF22cPu3FL54xA/VHvna39fGyo+iMH/nQH6Yd57LLV34fet/obA/RHu3YnSuXKNfG1Ph7IsDbHujYZVpnrh427i+eIFf7m2L/AOhH/BP+EDH+5ti/+hH/AAT/AIQI/wB1bD/7/wDpXf4AIl3bsSrTKlOnhbnx9qQGiXeWzRrR35+i3+loDRPvfa1Xpx8qT84wS/fA/JPvzGX4e33J/emo/MmB+Offl5/h7bCH3rjl80UB+K53xusqq3YxrS5Ppk38sqfIB+K53bvs9MuNteELcPpTYHz7u+bxd+vuWRTmo3HFfs0A+fcvXrzrduzuvxnJy+cDUAAAAAAAAAAAAAAAAAAAAAAAAZqwM9TAdXkA6gMdTAVfiBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//Z";
            }

            return model.Avatar;
        }
        public ActionResult PersonalData()
        {
            var model = new PersonalDataViewModel();

            return PartialView("_PersonalData", model);
        }
		public JsonResult UpdatePerconalData(PersonalDataViewModel model, string avatar)
        {
            if (Roles.IsUserInRole("lector"))
            {
                var modData = new ModifyLecturerViewModel(new Lecturer
                {
                    FirstName = model.Name,
					LastName = model.Surname,
                    MiddleName = model.Patronymic,
					IsLecturerHasGraduateStudents = model.IsLecturerHasGraduateStudents,
					IsSecretary = model.IsSecretary,
					Skill = model.Skill,
                    User = new User
                    {
                        UserName = model.UserName,
						Avatar = avatar,
						About = model.About,
						SkypeContact = model.SkypeContact,
						Phone = model.Phone,
						Email = model.Email,
                        Id = WebSecurity.CurrentUserId
                    },
                    Id = WebSecurity.CurrentUserId
                });

                modData.ModifyLecturer();
            }
            else
            {
                var modData = new ModifyStudentViewModel(new Student
                {
                    FirstName = model.Name,
					LastName = model.Surname,
                    MiddleName = model.Patronymic,
                    User = new User
                    {
                        UserName = model.UserName,
						Avatar = avatar,
						About = model.About,
						SkypeContact = model.SkypeContact,
						Phone = model.Phone,
						Email = model.Email,
                        Id = WebSecurity.CurrentUserId
                    },
                    Id = WebSecurity.CurrentUserId
                }); 
   
                modData.ModifyStudent();
            }

            return Json(true);
        }
        public ActionResult Management()
        {
            ViewBag.ReturnUrl = Url.Action("Management");
			var model = new PersonalDataViewModel();
	        ViewBag.Avatar = model.Avatar;
            return View();
        }