public void EditUserMobile(string email, string username, HttpPostedFileBase image)
        {
            ApplicationUser u = GetUserEmail(email);

            db.Entry(u).State = EntityState.Modified;
            if (image != null)
            {
                string path = new BLL.BlobStorage().StorageImageUser(image);
                u.UserImage = path;
            }
            u.Email    = email;
            u.UserName = username;

            db.SaveChanges();
        }
Exemple #2
0
 public ActionResult Records(Record record, string Lat, string Long)
 {
     record.AddDate = DateTime.Now;
     record.Lat     = Convert.ToDouble(Lat.Replace('.', ','));
     record.Long    = Convert.ToDouble(Long.Replace('.', ','));
     try
     {
         db.CreateRecord(record);
         record = db.GetLastRecord();
     }
     catch { }
     if (Request.Files.Count > 0)
     {
         var file = Request.Files[0];
         if (file != null && file.ContentLength > 0)
         {
             string path = new BLL.BlobStorage().StorageImageRecord(file);
             db.AddRecordImage(record, path);
         }
     }
     ViewBag.Records = db.GetRecords;
     return(View());
 }
Exemple #3
0
 public ActionResult Categories(Category category, Color catColor)
 {
     //Category category = new Category();
     //category.Name = Name;
     //category.Description = Description;
     category.Color = catColor.R.ToString("X2") + catColor.G.ToString("X2") + catColor.B.ToString("X2");
     try
     {
         db.CreateCategory(category);
         category = db.GetLastCategory();
     }
     catch { }
     if (Request.Files.Count > 0)
     {
         var file = Request.Files[0];
         if (file != null && file.ContentLength > 0)
         {
             string path = new BLL.BlobStorage().StorageImageCategory(file);
             db.AddCategoryImage(category.id, path);
         }
     }
     ViewBag.Categories = db.GetCategories;
     return(View());
 }
Exemple #4
0
        public ActionResult AddPlaylist(PlaylistViewModel model)
        {
            if (ModelState.IsValid)
            {
                string imagePath = null;
                if (Request.Files.Count > 0)
                {
                    var file = Request.Files[0];
                    if (file != null && file.ContentLength > 0)
                    {
                        imagePath = new BLL.BlobStorage().StorageImagePlaylist(file);
                    }
                }

                Playlist playlist = new Playlist();
                playlist.Author      = model.Author;
                playlist.Description = model.Description;
                playlist.Title       = model.Title;
                playlist.Category    = db.GetCategory(model.CategoryId);
                playlist.Image       = imagePath;
                db.CreatePlaylist(playlist);
            }
            return(RedirectToAction("Playlists"));
        }