Esempio n. 1
0
        // GET: Patron/Edit/5
        public ActionResult Update(Models.Patron patron)
        {
            Data.Patron persistentPatron = Mapper.Map <Models.Patron, Data.Patron>(patron);
            Patronizing.UpdatePatron(persistentPatron);

            return(Content(JsonConvert.SerializeObject(Mapper.Map <Data.Patron, Models.Patron>(persistentPatron))));
        }
Esempio n. 2
0
        public PatronDetailModel(Models.Patron p)
        {
            Id                = p.Id;
            FirstName         = p.FirstName;
            LastName          = p.LastName;
            LibraryCardId     = p.LibraryCard.Id;
            OverdueFees       = p.LibraryCard.Fees;
            HomeLibraryBranch = p.HomeLibraryBranch.Name;
            // this.LibraryCardId = base.LibraryCard.Id;

            Address         = p.Address;
            MemberSince     = p.LibraryCard.Created;
            TelephoneNumber = p.TelephoneNumber;
        }
Esempio n. 3
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            Models.Patron x = _context.Patrons.Where(c => c.LibraryCard.Id == (int)value)
                              //.FirstOrDefault();
                              .FirstOrDefault(c => c.LibraryCard.Id == Convert.ToInt32(value));

            if (x == null)
            {
                return(new ValidationResult($"Patron with the given Library Card Id {value} does not exist."));
            }
            else
            {
                return(ValidationResult.Success);
            }
        }