Exemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Form")] YeastForm yeastForm)
        {
            if (id != yeastForm.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(yeastForm);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!YeastFormExists(yeastForm.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(yeastForm));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Form")] YeastForm yeastForm)
        {
            if (ModelState.IsValid)
            {
                yeastForm.Id = Guid.NewGuid();
                _context.Add(yeastForm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(yeastForm));
        }
Exemplo n.º 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;
        }
Exemplo n.º 4
0
 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);
 }