Beispiel #1
0
        public String AddDefectiune(DTO.AddDefectiuneDTO addDefectiuneDTO)
        {
            DAL.defectiune defectiunedal = defectiuneConverter.ConvertDtoToDal(addDefectiuneDTO);

            DbContext.defectiune.Add(defectiunedal);

            DbContext.SaveChanges();

            return("SUCCES");
        }
Beispiel #2
0
        public DAL.defectiune ConvertDtoToDal(DTO.AddDefectiuneDTO dto)
        {
            String         nume = dto.Nume;
            Nullable <int> cost = dto.Cost;

            DAL.defectiune defectiune = new DAL.defectiune();
            defectiune.nume = nume;
            defectiune.cost = cost;

            return(defectiune);
        }
Beispiel #3
0
        public DAL.defectiune convertDtoToDalWithId(CustomerOrder.Service.DTO.ResponseDefectiuneDto dto)
        {
            int            id   = dto.Id;
            String         nume = dto.Nume;
            Nullable <int> cost = dto.Cost;

            DAL.defectiune defectiune = new DAL.defectiune();
            defectiune.idDefectiune = id;
            defectiune.nume         = nume;
            defectiune.cost         = cost;

            return(defectiune);
        }
Beispiel #4
0
        public bool UpdateDefectiune(int id, DTO.AddDefectiuneDTO defectiuneDto)
        {
            DAL.defectiune defectiune = (from def in DbContext.defectiune where def.idDefectiune == id select def).FirstOrDefault();

            if (defectiune != null)
            {
                defectiune.nume = defectiuneDto.Nume;
                defectiune.cost = defectiuneDto.Cost;

                DbContext.SaveChanges();
            }
            return(true);
        }