예제 #1
0
        public async Task <DTOvalidator> Postvalidator(DTOvalidator newDTO)
        {
            validator newProd = EntityMapper.updateEntity(null, newDTO);

            db.validators.Add(newProd);
            await db.SaveChangesAsync();

            return(newDTO);
        }
예제 #2
0
        public async Task <IHttpActionResult> Putvalidator(int ID, DTOvalidator editedDTO)
        {
            validator toUpdate = db.validators.Find(ID);

            toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO);
            db.Entry(toUpdate).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public static validator updateEntity(validator entityObjct, DTOvalidator dto)
        {
            if (entityObjct == null)
            {
                entityObjct = new validator();
            }

            entityObjct.Validator_ID             = dto.Validator_ID;
            entityObjct.User_ID                  = dto.User_ID;
            entityObjct.validatiorCompany        = dto.validatiorCompany;
            entityObjct.validatorLicenseNumber   = dto.validatorLicenseNumber;
            entityObjct.validatorLicenseProvider = dto.validatorLicenseProvider;
            entityObjct.validatorValidUntil      = dto.validatorValidUntil;
            entityObjct.validatorVATNumber       = dto.validatorVATNumber;
            entityObjct.validatorAddress         = dto.validatorAddress;
            entityObjct.validatorBankName        = dto.validatorBankName;
            entityObjct.validatorBankAccNumber   = dto.validatorBankAccNumber;
            entityObjct.validatorBankBranchName  = dto.validatorBankBranchName;
            entityObjct.validatorBankBranchCode  = dto.validatorBankBranchCode;

            return(entityObjct);
        }
예제 #4
0
 /// <summary>
 /// Validating method used to perform error checks and validation to the information that the user inputs
 /// and will outline any error-related messages out to the console if one was found 
 /// </summary>
 /// <param name="regex">The regex expression used for testing the validity of the string</param>
 /// <param name="message">Message pertaining to what is asked from the user and what information is being requested by the program</param>
 /// <param name="errorMessage">Message outlining the error involved with the inputted answer</param>
 /// <returns>Returns the string of information read from the console</returns>
 public string InputTillCorrect(validator validatorMethod,string message,string errorMessage,bool canBeEmpty = false)
 {
     string lineIn = null;
     for (; lineIn==null || !validatorMethod(lineIn); )
     {
         Console.WriteLine(message);
         lineIn = Console.ReadLine();
         Console.Clear();
         if (canBeEmpty && lineIn == "")
         {
             break;
         }
         Console.WriteLine(errorMessage);
     }
     Console.Clear();
     return lineIn;
 }