Ejemplo n.º 1
0
        public BackEnd.Controllers.Response.BanhoTosaResponse AgendamentoBanhoTosa(BackEnd.Controllers.Request.BanhoTosaRequest request)
        {
            Models.TbBanhoTosa tbBanhoTosa = new Models.TbBanhoTosa();

            tbBanhoTosa.DsBanho       = request.Banho;
            tbBanhoTosa.DsDentes      = request.Dentes;
            tbBanhoTosa.DsLocal       = request.Local;
            tbBanhoTosa.DsObservacoes = request.Observacoes;
            tbBanhoTosa.DsTosa        = request.Tosa;
            tbBanhoTosa.DsUnhas       = request.Unhas;
            tbBanhoTosa.DtBanhoTosa   = request.Data;
            tbBanhoTosa.IdCliente     = request.IdCliente;
            tbBanhoTosa.IdPet         = request.IdPet;

            ctx.Add(tbBanhoTosa);
            ctx.SaveChanges();

            BackEnd.Controllers.Response.BanhoTosaResponse response = new BackEnd.Controllers.Response.BanhoTosaResponse();

            response.Banho       = request.Banho;
            response.Dentes      = request.Dentes;
            response.Local       = request.Local;
            response.Observacoes = request.Observacoes;
            response.Tosa        = request.Tosa;
            response.Unhas       = request.Unhas;
            response.Data        = request.Data;
            response.IdCliente   = request.IdCliente;
            response.IdPet       = request.IdPet;

            return(response);
        }
Ejemplo n.º 2
0
        public BackEnd.Controllers.Response.BanhoTosaResponse AgendarVacina(BackEnd.Controllers.Request.BanhoTosaRequest request)
        {
            Database.BanhoTosaDatabase database = new Database.BanhoTosaDatabase();

            if (string.IsNullOrEmpty(request.Local))
            {
                throw new Exception("Local Inválido");
            }

            BackEnd.Controllers.Response.BanhoTosaResponse response = database.AgendamentoBanhoTosa(request);

            return(response);
        }
        public ActionResult <BackEnd.Controllers.Response.BanhoTosaResponse> response(BackEnd.Controllers.Request.BanhoTosaRequest request)
        {
            try
            {
                Business.BanhoTosaBusiness business = new Business.BanhoTosaBusiness();

                BackEnd.Controllers.Response.BanhoTosaResponse response = business.AgendarVacina(request);

                return(response);
            }
            catch (System.Exception ex)
            {
                return(new BadRequestObjectResult(
                           new BackEnd.Controllers.Response.ErroResponse(ex, 400)
                           ));
            }
        }