示例#1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Type")] YeastType yeastType)
        {
            if (id != yeastType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(yeastType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!YeastTypeExists(yeastType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(yeastType));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Type")] YeastType yeastType)
        {
            if (ModelState.IsValid)
            {
                yeastType.Id = Guid.NewGuid();
                _context.Add(yeastType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(yeastType));
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Yeast"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="form">The form.</param>
        /// <param name="amountInKgOrLiters">The amount in kg or liters.</param>
        /// <param name="name">The name.</param>
        /// <param name="amountIsWeight">if set to <c>true</c> [amount is weight].</param>
        /// <param name="version">The version.</param>
        public Yeast(
            YeastType type,
            YeastForm form,
            double amountInKgOrLiters,
            string name,
            bool amountIsWeight = false,
            int version         = Constants.DEFAULT_BEER_XML_VERSION) : base(name, version)
        {
            Validation.ValidateGreaterThanZero(amountInKgOrLiters);

            this.Type             = type;
            this.Form             = form;
            this.Amount           = amountInKgOrLiters;
            this.Amount_Is_Weight = amountIsWeight;
        }
 public YeastCharacteristics(string type, string flocculation, string form)
 {
     m_type = EnumConverter.Parse<YeastType>(type);
     m_flocculation = EnumConverter.Parse<Flocculation>(flocculation);
     m_form = EnumConverter.Parse<YeastForm>(form);
 }