示例#1
0
        public void VetCurrnetJob()
        {
            VetRegistracion vet        = new VetRegistracion();
            var             getAllProd = _vetContext.GetAllVet(vet);

            foreach (var item in getAllProd)
            {
                var productEndDateInStirng = item.RegistrationDateTime.AddDays(31).ToString("MM/dd/yyyy");
                if (productEndDateInStirng == DateTime.Now.ToString("MM/dd/yyyy"))
                {
                    _vetContext.RemoveVet(item);
                    //_vetContext.SaveChange();
                }
            }
        }
示例#2
0
        public async Task <IActionResult> RemoveVet(int id)
        {
            var getVet   = _context.GetVetById(id);
            var findUser = await _userManager.FindByNameAsync(User.Identity.Name);

            if (findUser.UserName == getVet.UserName)
            {
                _context.RemoveVet(getVet);
                _context.SaveChange();
                return(RedirectToAction("VetProducts", "UserProduct"));
            }
            else
            {
                TempData["Message"] = "მსგავსი განცხადება თქვენ არ გეკუთვნით";
                return(RedirectToAction("VetProducts", "UserProduct"));
            }
        }