Ejemplo n.º 1
0
        public static Substance Create(SubstanceDto dto)
        {
            var subst = new Substance
            {
                Name = dto.Name
            };

            Validate(subst);
            return(subst);
        }
Ejemplo n.º 2
0
        public static Substance Create(SubstanceDto dto, SubstanceGroup substanceGroup)
        {
            var substance = Create(dto);

            if (substanceGroup == null)
            {
                return(substance);
            }

            substance.SetSubstanceGroup(substanceGroup);
            return(substance);
        }
        public ActionResult SaveSubstance(SubstanceDto dto)
        {
            if (String.IsNullOrWhiteSpace(dto.Name))
            {
                return(this.Direct(new { success = false }));
            }

            if (dto.Id == Guid.Empty.ToString())
            {
                dto.Id = new Guid().ToString();
            }
            return(this.Direct(new { success = true, data = dto }));
        }
Ejemplo n.º 4
0
        public ActionResult AddNewSubstance(SubstanceDto substanceDto)
        {
            var success = true;
            var message = String.Empty;

            try
            {
            }
            catch (Exception e)
            {
                success = false;
                message = e.ToString();
            }

            return this.Direct(new { success, data = substanceDto, message });
        }
Ejemplo n.º 5
0
        public ActionResult AddNewSubstance(SubstanceDto substanceDto)
        {
            var success = true;
            var message = String.Empty;

            try
            {
            }
            catch (Exception e)
            {
                success = false;
                message = e.ToString();
            }

            return(this.Direct(new { success, data = substanceDto, message }));
        }
Ejemplo n.º 6
0
        public ActionResult SaveSubstance(SubstanceDto dto)
        {
            if (String.IsNullOrWhiteSpace(dto.Name))
                return this.Direct(new { success = false });

            if (dto.Id == Guid.Empty.ToString()) dto.Id = new Guid().ToString();
            return this.Direct(new { success = true, data = dto });
        }