Пример #1
0
 public ActionResult ProcessAddition(string meta)
 {
     string[] source = meta.Split(new char[]
     {
         '~'
     });
     PhotoRepository photoRepository = new PhotoRepository(new yslDataContext());
     AccountRepository accountRepository = new AccountRepository(new yslDataContext());
     MemberRepository memberRepository = new MemberRepository(new yslDataContext());
     Request.Cookies.Get("ysl");
     string text = source.Last<string>();
     string text2 = text;
     text2 = text2.Replace("/temp", "");
     string text3 = Server.MapPath(text);
     string destFileName = text3.Replace("\\temp", "");
     try
     {
         System.IO.File.Move(text3, destFileName);
         Account account = new Account
         {
             FirstName = source.First<string>(),
             LastName = source.ElementAt(1),
             Email = source.ElementAt(3),
             Password = "******"
         };
         int accountId = accountRepository.addAccount(account);
         Photo photo = new Photo
         {
             AccountId = accountId,
             Title = "",
             Description = "",
             Location = text2
         };
         int value = photoRepository.addPhoto(photo);
         memberRepository.addMember(new Member
         {
             AccountId = accountId,
             Name = source.ElementAt(2),
             PhotoId = new int?(value)
         });
     }
     catch
     {
     }
     return View();
 }