public IHttpActionResult AddComanda([FromUri] int idClient, [FromUri] int idEmployee, [FromUri] int idTelefon, [FromUri] int idUnicTelefon, [FromUri] bool stare, [FromUri] string DataDeschidere, [FromUri] string DataInchidere)
 {
     DAL.Comanda cm = new DAL.Comanda();
     cm.idClient       = idClient;
     cm.idEmployee     = idEmployee;
     cm.idTelefon      = idTelefon;
     cm.idUnicTelefon  = idUnicTelefon;
     cm.stare          = stare;
     cm.DataDeschidere = DateTime.ParseExact(DataDeschidere, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
     cm.DataInchidere  = DateTime.ParseExact(DataInchidere, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
     return(Ok(comandaService.AddComanda(cm)));
 }
示例#2
0
        public IHttpActionResult AddComanda([FromBody] AddComandaDto addComandaDto1)
        {
            DAL.Comanda cm = new DAL.Comanda();
            cm.idClient       = addComandaDto1.idClient;
            cm.idEmployee     = addComandaDto1.idEmployee;
            cm.idTelefon      = addComandaDto1.idTelefon;
            cm.idUnicTelefon  = addComandaDto1.idUnicTelefon;
            cm.stare          = addComandaDto1.stare;
            cm.DataDeschidere = DateTime.ParseExact(addComandaDto1.DataDeschidere, "yyyy-MM-dd", CultureInfo.InvariantCulture);

            if (String.IsNullOrEmpty(addComandaDto1.DataInchidere))
            {
                cm.stare = false;
            }
            else
            {
                cm.DataInchidere = DateTime.ParseExact(addComandaDto1.DataInchidere, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                cm.stare         = true;
            }

            cm.defectiune = addComandaDto1.DefectiuneDtos;

            return(Ok(comandaService.AddComanda(cm)));
        }