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)));
 }
        public bool updateComanda(int id, bool stare, string DataInchidere)
        {
            bool succes = false;

            DAL.Comanda t = DbContext.Comanda.Find(id);
            if (t != null)
            {
                t.stare         = stare;
                t.DataInchidere = DateTime.ParseExact(DataInchidere, "yyyy-MM-dd", CultureInfo.InvariantCulture);;
                DbContext.SaveChanges();
                succes = true;
                return(succes);
            }


            return(succes);
        }
        public Boolean delete(int id)
        {
            bool succes = false;


            DAL.Comanda t = DbContext.Comanda.Find(id);
            if (t != null)
            {
                DbContext.Comanda.Remove(t);
                DbContext.SaveChanges();
                succes = true;
                return(succes);
            }


            return(succes);
        }
Exemple #4
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)));
        }
 public String AddComanda(DAL.Comanda addComandaDto)
 {
     DbContext.Comanda.Add(addComandaDto);
     DbContext.SaveChanges();
     return("adaugat");
 }