public MarksDto Add_Mark(MarksDto marks)
        {
            MapperDto_Class.ConfigAutoMapper();

            if (this.IsValidmark(marks))
            {
                var NewMARK = repository.Insert(Mapper.Map <Marks>(marks));

                return(Mapper.Map <MarksDto>(NewMARK));
            }
            else
            {
                throw new ArgumentNullException("Provided information is not valid.");
            }
        }
        private bool IsValidmark(MarksDto marks)
        {
            if (marks == null)
            {
                throw new ArgumentNullException("Null reference ");
            }

            if (string.IsNullOrEmpty(marks.Maths.ToString()))
            {
                throw new ArgumentNullException("Maths:validation error");
            }
            if (string.IsNullOrEmpty(marks.Science.ToString()))
            {
                throw new ArgumentNullException("Science:validation error");
            }

            if (string.IsNullOrEmpty(marks.Language.ToString()))
            {
                throw new ArgumentNullException("Language:validation error");
            }

            return(true);
        }
Ejemplo n.º 3
0
 public ReturnData <List <MarkModule> > AddMarks(int studentId, MarksDto marksDto)
 {
     return(null);
 }
Ejemplo n.º 4
0
        public ReturnData <List <MarkModule> > AddMarks([FromRoute] int id, [FromBody] MarksDto marksDto)
        {
            CollegeServices cs = new CollegeServices();

            return(cs.AddMarks(id, marksDto));
        }