Exemplo n.º 1
0
        //public string Save(CourseAssignToTeacher courseAssignToTeacher)
        //{

        //    return courseAssignToTeacherGateway.Save(courseAssignToTeacher);
        //}


        public string Save(CourseAssignToTeacher courseAssignToTeacher)
        {
            CourseAssignToTeacher courseAssignTo = GetAll.ToList().Find(ca => ca.CourseId == courseAssignToTeacher.CourseId);

            if (courseAssignTo == null)
            {
                if (courseAssignToTeacherGateway.Insert(courseAssignToTeacher) > 0)
                {
                    return("Saved sucessfully");
                }
                return("Failed to save");
            }
            CourseAssignToTeacher assignTo = GetAll.ToList().Find(c => c.CourseId == courseAssignToTeacher.CourseId && c.TeacherId == courseAssignToTeacher.TeacherId);

            if (assignTo != null)
            {
                bool st = assignTo.Status;
                if (st)
                {
                    return("Overlapping occured(Course has been assigned to this Teacher Already)");
                }
                if (courseAssignToTeacherGateway.Update(courseAssignToTeacher) > 0)
                {
                    return("Saved sucessfully");
                }
                return("Failed to save");
            }

            return("Overlapping Occured!(Course has already been Assigned to Another Teacher )");
        }
        public string Save(CourseAssignToTeacher courseAssign)
        {
            CourseAssignToTeacher courseAssignTo = GetAll.ToList().Find(ca => ca.CourseId == courseAssign.CourseId && ca.Status);

            if (courseAssignTo == null)
            {
                if (courseAssignToTeacherGateway.Insert(courseAssign) > 0)
                {
                    return("Saved sucessfully");
                }
                return("Failed to save");
            }
            //CourseAssignToTeacher assignTo =
            //    GetAll.ToList().Find(c => c.CourseId == courseAssign.CourseId && c.TeacherId == courseAssign.TeacherId);
            //if (assignTo != null)
            //{
            //    bool st = assignTo.Status;
            //    if (st)
            //    {
            //        return "Overlaping not allowed during course assign";
            //    }
            //    if (courseAssignToTeacherGateway.Update(courseAssign) > 0)
            //    {
            //        return "Saved sucessfully";
            //    }
            //    return "Failed to save";

            //}

            return("Overlaping not allowed!");
        }
Exemplo n.º 3
0
        public string Save(CourseAssignToTeacher courseAssign)
        {
            CourseAssignToTeacher courseAssignTo = GetAll.ToList().Find(ca => ca.CourseId == courseAssign.CourseId && ca.Status);

            if (courseAssignTo == null)
            {
                if (courseAssignToTeacherGateway.Insert(courseAssign) > 0)
                {
                    return("Assigned successfully");
                }
                return("Failed to save");
            }

            return("Overlaping not allowed!");
        }