Exemplo n.º 1
0
        public void updateDb(InfoUserModel iu, string photo, string email)
        {
            InfoUserModel info = tables_conection.InfoUser.SingleOrDefault(x => x.Email == email);

            if (info != null && iu != null)
            {
                info.Adress   = iu.Adress;
                info.Phone    = iu.Phone;
                info.FullName = iu.FullName;
                info.AboutMe  = iu.AboutMe;
                if (photo != "")
                {
                    info.Photo = photo;
                }

                tables_conection.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public async Task deleteRecord(string id)
        {
            int    ident    = Int32.Parse(id);
            var    record   = tables_conection.UserVideosTable.SingleOrDefault(x => x.Id == ident);
            string filename = record.Video;

            tables_conection.UserVideosTable.Remove(record);
            tables_conection.SaveChanges();

            string absolute_path = Path.Combine(env.WebRootPath, filename);


            System.IO.File.Delete(absolute_path);
        }
Exemplo n.º 3
0
        public IActionResult Register(User u)
        {
            Uniqe check = new Uniqe(_cs);

            if (check.isUnique(u) == 3)
            {
                _cs.UserTable.Add(new User {
                    Email = u.Email, Password = Encoder.Md5_encrypt(u.Password), Username = u.Username
                });
                _cs.SaveChanges();
                _cs.InfoUser.Add(new InfoUserModel(u.Email, "", "", "", "", ""));
                _cs.SaveChanges();
            }
            else if (check.isUnique(u) == 1)
            {
                ViewBag.Message = "Already exist this username";
            }
            else if (check.isUnique(u) == 2)
            {
                ViewBag.Message = "Already exist an user with this email";
            }

            return(View());
        }