Example #1
0
 public IActionResult Edit(Damakeba damakeba, int id)
 {
     if (ModelState.IsValid)
     {
         var product = _damakebaNoDoucument.GetProductById(id);
         product.Title       = damakeba.Title;
         product.Sex         = damakeba.Sex;
         product.Jishebi     = damakeba.Jishebi;
         product.City        = damakeba.City;
         product.Age         = damakeba.Age;
         product.Description = damakeba.Description;
         product.EmployeName = damakeba.EmployeName;
         product.PhoneNumber = damakeba.PhoneNumber;
         if (damakeba.DamakebaPhotoUrl == null)
         {
             damakeba.DamakebaPhotoUrl = product.DamakebaPhotoUrl;
         }
         else
         {
             product.DamakebaPhotoUrl = damakeba.DamakebaPhotoUrl;
         }
         damakeba.UserName  = product.UserName;
         product.Document   = damakeba.Document;
         damakeba.Published = product.Published;
         _damakebaNoDoucument.SaveChange();
         return(RedirectToAction("Details", new { id = damakeba.ID }));
     }
     return(View());
 }
Example #2
0
        public async Task <IActionResult> DamakebaProducts(User user, Damakeba damakeba)
        {
            var appUser = await _userManager.FindByNameAsync(User.Identity.Name);

            user.Email    = appUser.Email;
            user.UserName = appUser.UserName;
            var productList = _damakebaContext.GetAllProduct(damakeba).Where(e => e.UserName == user.UserName).OrderByDescending(e => e.Published).ToList();

            return(View(productList));
        }
Example #3
0
        public async Task <IActionResult> NoDocument(DamakebaViewModel damakebaViewModel)
        {
            if (ModelState.IsValid)
            {
                if (damakebaViewModel.DamakebaPhoto != null)
                {
                    string folder = "Images/DamakebaPhoto/";
                    folder += Guid.NewGuid().ToString() + "_" + damakebaViewModel.DamakebaPhoto.FileName;

                    damakebaViewModel.DamakebaPhotoUrl = "/" + folder;

                    string serverFolder = Path.Combine(_env.WebRootPath, folder);

                    await damakebaViewModel.DamakebaPhoto.CopyToAsync(new FileStream(serverFolder, FileMode.Create));
                }
                Damakeba damakeba = new Damakeba
                {
                    Published        = DateTime.Now,
                    Document         = Document.No,
                    UserName         = User.Identity.Name,
                    DamakebaPhotoUrl = damakebaViewModel.DamakebaPhotoUrl,
                    Title            = damakebaViewModel.Title,
                    Jishebi          = damakebaViewModel.Jishebi,
                    Sex         = damakebaViewModel.Sex,
                    City        = damakebaViewModel.City,
                    Age         = damakebaViewModel.Age,
                    Description = damakebaViewModel.Description,
                    EmployeName = damakebaViewModel.EmployeName,
                    PhoneNumber = damakebaViewModel.PhoneNumber,
                };
                damakeba.Published = DateTime.Now;
                _damakebaNoDoucument.CreateProduct(damakeba);
                _damakebaNoDoucument.SaveChange();
                return(RedirectToAction("Details", new { id = damakeba.ID }));
            }
            return(View());
        }
 public Damakeba RemoveProduct(Damakeba damakebaNoDocument)
 {
     _context.Damakeba.Remove(damakebaNoDocument);
     return(damakebaNoDocument);
 }
 public IEnumerable <Damakeba> GetAllProduct(Damakeba damakebaNoDocument)
 {
     return(_context.Damakeba);
 }
 public Damakeba CreateProduct(Damakeba damakebaNoDocument)
 {
     _context.Damakeba.Add(damakebaNoDocument);
     return(damakebaNoDocument);
 }
Example #7
0
 public IActionResult Products(Damakeba damakebaNoDocument)
 {
     return(View(_damakebaNoDoucument.GetAllProduct(damakebaNoDocument).OrderByDescending(e => e.Published)));
 }
Example #8
0
        public async Task <IActionResult> UserProfile(User user, VetRegistracion vetRegistracion, PetRegistration petRegistration, JobVacancy jobVacancy, Damakeba damakeba)
        {
            var appUser = await _userManager.FindByNameAsync(User.Identity.Name);

            user.Email    = appUser.Email;
            user.UserName = appUser.UserName;
            if (appUser.GenderValue == 0)
            {
                user.UserGender = 0;
            }
            else
            {
                user.UserGender = 1;
            }
            user.VetCount      = _vetContext.GetAllVet(vetRegistracion).Where(e => e.UserName == user.UserName).ToList().Count();
            user.PetCount      = _petContext.GetAllPet(petRegistration).Where(e => e.UserName == user.UserName).ToList().Count();
            user.VacancyCount  = _vacancyContext.GetAllJob(jobVacancy).Where(e => e.UserName == user.UserName).ToList().Count();
            user.DamakebaCount = _damakebaContext.GetAllProduct(damakeba).Where(e => e.UserName == user.UserName).ToList().Count();
            return(View(user));
        }